Created
March 24, 2021 12:48
-
-
Save sergiolucero/a3fffa0c028857df4277efdd166e4919 to your computer and use it in GitHub Desktop.
Street splitter
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
# shape source: https://geoine-ine-chile.opendata.arcgis.com/datasets/186b78e22db44f96a016f9254de44dd4_0 | |
import geopandas as gp | |
gdf = gp.read_file('MAESTRO_CALLES',init={'epsg:3857'}) | |
gdf = gdf.to_crs('epsg:4326') | |
gdf.columns=[c.lower() for c in gdf.columns] | |
for comuna, cdf in gdf.groupby('comuna'): | |
ddf = cdf[['comuna','nombre_aux','geometry']] | |
ddf.to_file(f'CALLES/{comuna.replace(" ","_")}.json', engine='GeoJSON', single_file=True) | |
print(comuna,len(ddf)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment