Created
June 14, 2021 08:16
-
-
Save willrayeo/81978fb81a1160971d4a02c78c7ba981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Request the administrative boundaries as a bytes dataset. | |
france_admin_url = "https://www.data.gouv.fr/en/datasets/r/17062524-991f-4e13-9bf0-b410cc2216fd" | |
france_admin = requests.get(france_admin_url, stream=True) | |
france_admin_bytes = bytes(france_admin.content) | |
# Import administrative boundaries into a Geodataframe | |
with fiona.BytesCollection(france_admin_bytes) as f: | |
crs = f.crs | |
france_df = gpd.GeoDataFrame.from_features(f, crs=crs) | |
# Clear variables | |
france_admin_bytes = None | |
france_admin = None | |
# Select the municipalities of interest based on their Insee code. | |
municipalities = france_df[france_df['insee'].isin(["17024", "17268", "17473"])] | |
aoi = municipalities.dissolve() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment