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); }
static async Task GetCountry(int year, string url, string mapsPath) { var zip = Path.Combine(DataLocations.TempPath, year + ".zip"); await Downloader.DownloadFile(zip, url); var targetPath = Path.Combine(mapsPath, "australia.geojson"); var extractDirectory = Path.Combine(DataLocations.TempPath, $"australia{year}_extract"); ZipFile.ExtractToDirectory(zip, extractDirectory); MapToGeoJson.ConvertTab(targetPath, Path.Combine(extractDirectory, "COM_ELB.tab")); var featureCollection = JsonSerializer.Deserialize <FeatureCollection>(targetPath); featureCollection.FixBoundingBox(); MetadataCleaner.CleanMetadata(featureCollection); JsonSerializer.SerializeGeo(featureCollection, targetPath); }