| 9 | from shapely.geometry import shape |
| 10 | |
| 11 | def main(): |
| 12 | # this is the name of the geography you want to retrieve. update to meet your needs |
| 13 | location = 'Greece' |
| 14 | |
| 15 | dataset_links = pd.read_csv("https://minedbuildings.z5.web.core.windows.net/global-buildings/dataset-links.csv") |
| 16 | greece_links = dataset_links[dataset_links.Location == location] |
| 17 | for _, row in greece_links.iterrows(): |
| 18 | df = pd.read_json(row.Url, lines=True) |
| 19 | df['geometry'] = df['geometry'].apply(shape) |
| 20 | gdf = gpd.GeoDataFrame(df, crs=4326) |
| 21 | gdf.to_file(f"{row.QuadKey}.geojson", driver="GeoJSON") |
| 22 | |
| 23 | |
| 24 | if __name__ == "__main__": |