static FeatureCollection WriteState(State state, string shpFile)
    {
        var stateJsonPath = Path.Combine(DataLocations.TempPath, $"{state}.geojson");

        MapToGeoJson.ConvertShape(stateJsonPath, shpFile);

        var stateCollection = JsonSerializer.Deserialize <FeatureCollection>(stateJsonPath);

        MetadataCleaner.CleanMetadata(stateCollection, state);
        return(stateCollection);
    }
Пример #2
0
    static void WriteOptimised(string directory)
    {
        var jsonPath = Path.Combine(directory, "australia.geojson");
        var raw      = JsonSerializer.DeserializeGeo(jsonPath);

        raw.FixBoundingBox();
        foreach (var percent in percents)
        {
            var percentJsonPath = Path.Combine(directory, $"australia_{percent:D2}.geojson");
            MapToGeoJson.ConvertShape(percentJsonPath, jsonPath, percent);
            var featureCollection = JsonSerializer.DeserializeGeo(percentJsonPath);
            featureCollection.FixBoundingBox();

            JsonSerializer.SerializeGeo(featureCollection, percentJsonPath);
        }
    }