Administrative boundary regionalizer
import geopandas as gpd
import plotly.express as px
from shapely.geometry import Point, box
from srai.plotting.folium_wrapper import plot_regions
from srai.regionalizers import AdministrativeBoundaryRegionalizer, geocode_to_region_gdf
Regionalize city¶
Basic usage of the AdministrativeBoundaryRegionalizer
with a city boundary.
Here admin_level
equal to 9 defines city districts in Poland.
wroclaw_gdf = geocode_to_region_gdf(query=["R451516"], by_osmid=True)
plot_regions(wroclaw_gdf)
abr = AdministrativeBoundaryRegionalizer(admin_level=9)
wro_result_gdf = abr.transform(gdf=wroclaw_gdf)
wro_result_gdf.head()
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 27: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 28: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 29: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 30: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 31: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 32: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 33: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 34: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 35: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 36: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 37: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 38: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 39: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 40: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 41: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 42: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 43: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 44: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 45: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 46: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 47: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 48: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 48: 100%|██████████| 1/1 [00:00<00:00, 3.07it/s]
Loading boundaries: 48: 100%|██████████| 1/1 [00:00<00:00, 3.06it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
geometry | |
---|---|
region_id | |
Ołtaszyn | POLYGON ((17.01348 51.05742, 17.01446 51.05859... |
Wojszyce | POLYGON ((17.05334 51.07127, 17.05398 51.06999... |
Krzyki-Partynice | POLYGON ((16.98336 51.07738, 16.98405 51.07724... |
Gaj | POLYGON ((17.02233 51.07306, 17.02267 51.07304... |
Borek | POLYGON ((17.00113 51.08951, 17.00615 51.08810... |
plot_regions(wro_result_gdf)
Regionalize country¶
How to return an empty region covering water bodies outside of the land.
Here admin_level
equal to 4 defines country regions in Madagascar.
madagascar_bbox = box(minx=43.21418, miny=-25.61143, maxx=50.48704, maxy=-11.951126)
madagascar_bbox_gdf = gpd.GeoDataFrame({"geometry": [madagascar_bbox]}, crs="EPSG:4326")
abr = AdministrativeBoundaryRegionalizer(admin_level=4, return_empty_region=True)
madagascar_result_gdf = abr.transform(gdf=madagascar_bbox_gdf)
madagascar_result_gdf.tail()
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 26: 100%|██████████| 1/1 [00:01<00:00, 1.55s/it]
Loading boundaries: 26: 100%|██████████| 1/1 [00:01<00:00, 1.55s/it]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
geometry | |
---|---|
region_id | |
Diana Region | MULTIPOLYGON (((48.35872 -13.60528, 48.35853 -... |
Mayotte | MULTIPOLYGON (((45.01840 -12.64340, 45.01860 -... |
Moheli | MULTIPOLYGON (((43.62245 -12.28540, 43.62292 -... |
Anjouan | MULTIPOLYGON (((44.19878 -12.16511, 44.19946 -... |
EMPTY | MULTIPOLYGON (((43.21418 -25.61143, 43.21418 -... |
plot_regions(madagascar_result_gdf)
Regionalize Europe¶
Option to slightly increase the value of toposiplify
to simplify geometries even more.
Here admin_level
equal to 2 defines countries.
eu_bbox = box(minx=-10.478556, miny=34.633284672291, maxx=32.097916, maxy=70.096054)
eu_bbox_gdf = gpd.GeoDataFrame({"geometry": [eu_bbox]}, crs="EPSG:4326")
abr = AdministrativeBoundaryRegionalizer(admin_level=2, toposimplify=0.0005)
eu_result_gdf = abr.transform(gdf=eu_bbox_gdf)
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:01<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:02<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:04<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:04<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:04<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:05<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:05<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:05<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 27: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 28: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 29: 0%| | 0/1 [00:07<?, ?it/s]
Loading boundaries: 30: 0%| | 0/1 [00:07<?, ?it/s]
Loading boundaries: 31: 0%| | 0/1 [00:07<?, ?it/s]
Loading boundaries: 32: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 33: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 34: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 35: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 36: 0%| | 0/1 [00:09<?, ?it/s]
Loading boundaries: 37: 0%| | 0/1 [00:09<?, ?it/s]
Loading boundaries: 38: 0%| | 0/1 [00:09<?, ?it/s]
Loading boundaries: 39: 0%| | 0/1 [00:09<?, ?it/s]
Loading boundaries: 40: 0%| | 0/1 [00:09<?, ?it/s]
Loading boundaries: 41: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 42: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 43: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 44: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 45: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 46: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 47: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 48: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 49: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 50: 0%| | 0/1 [00:12<?, ?it/s]
Loading boundaries: 51: 0%| | 0/1 [00:13<?, ?it/s]
Loading boundaries: 52: 0%| | 0/1 [00:13<?, ?it/s]
Loading boundaries: 53: 0%| | 0/1 [00:13<?, ?it/s]
Loading boundaries: 54: 0%| | 0/1 [00:13<?, ?it/s]
Loading boundaries: 54: 100%|██████████| 1/1 [00:13<00:00, 13.60s/it]
Loading boundaries: 54: 100%|██████████| 1/1 [00:13<00:00, 13.60s/it]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
eu_result_gdf.head()
geometry | |
---|---|
region_id | |
France | MULTIPOLYGON (((-2.77861 49.27876, -2.73805 49... |
Algeria | POLYGON ((-2.18305 35.33251, -2.05473 35.32209... |
Morocco | POLYGON ((-5.88545 35.96488, -5.66652 35.93567... |
Netherlands | MULTIPOLYGON (((3.08610 51.57045, 3.09529 51.5... |
Spain | MULTIPOLYGON (((-1.77176 43.48807, -1.77176 43... |
plot_regions(eu_result_gdf)
Toposimplify differences¶
Shows differences in simplification of small regions using four values: 1e-4
, 1e-3
, 1e-2
and 0.1
. Those values are in degress, since it uses Douglas-Peucker simplification algorithm.
1e-4
is the default value and is equal to about 11.1m accuracy.
More info: https://github.com/mattijn/topojson
Here admin_level
equal to 6 defines city districts in Singapore.
singapore_bbox = box(minx=103.5111238, miny=1.1263707, maxx=104.1313374, maxy=1.4787511)
singapore_bbox_gdf = gpd.GeoDataFrame({"geometry": [singapore_bbox]}, crs="EPSG:4326")
results = {}
for value in [0.0001, 0.001, 0.01, 0.1]:
abr = AdministrativeBoundaryRegionalizer(admin_level=6, toposimplify=value)
results[value] = abr.transform(gdf=singapore_bbox_gdf)
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 100%|██████████| 1/1 [00:00<00:00, 18.92it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 100%|██████████| 1/1 [00:00<00:00, 19.06it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 100%|██████████| 1/1 [00:00<00:00, 19.03it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
Loading boundaries: 0: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:00<?, ?it/s]
Loading boundaries: 8: 100%|██████████| 1/1 [00:00<00:00, 18.18it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:168: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead. ].geometry.unary_union
minx, miny, maxx, maxy = singapore_bbox.bounds
for epsilon, result in results.items():
fig = px.choropleth_mapbox(
result,
geojson=result,
color=result.index,
locations=result.index,
center={"lat": 1.3119350704252704, "lon": 103.82412242562575},
mapbox_style="carto-positron",
zoom=9.5,
)
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
fig.update_traces(marker={"opacity": 0.6}, selector=dict(type="choroplethmapbox"))
fig.update_traces(showlegend=False)
fig.update_geos(
projection_type="equirectangular",
lataxis_range=[miny - 0.1, maxy + 0.1],
lonaxis_range=[minx - 0.1, maxx + 0.1],
showlakes=False,
showcountries=False,
showframe=False,
resolution=50,
)
size = len(result.to_json().encode("utf-8"))
fig.update_layout(
height=450,
width=700,
margin={"r": 0, "t": 50, "l": 0, "b": 0},
title_text=f"Toposimplify value: {epsilon} ({size/1000} KB)",
)
fig.show(renderer="png") # replace with fig.show() to allow interactivity
Regionalize points¶
How to return original regions without clipping and select them using list of points. Showed using list of metro stations in Paris.
Here admin_level
equal to 8 defines communes in France.
import requests
r = requests.get("https://raw.githubusercontent.com/w8r/paris-metro-graph/master/metro.json").json()
stations_gdf = gpd.GeoDataFrame(
{"geometry": [Point(s["longitude"], s["latitude"]) for s in r["nodes"]]}, crs="EPSG:4326"
)
stations_gdf
geometry | |
---|---|
0 | POINT (2.30159 48.81081) |
1 | POINT (2.29703 48.81534) |
2 | POINT (2.24947 48.88824) |
3 | POINT (2.27210 48.88106) |
4 | POINT (2.28937 48.87558) |
... | ... |
309 | POINT (2.33812 48.88228) |
310 | POINT (2.34955 48.88729) |
311 | POINT (2.35482 48.84599) |
312 | POINT (2.29583 48.87493) |
313 | POINT (2.40655 48.87706) |
314 rows × 1 columns
abr = AdministrativeBoundaryRegionalizer(
admin_level=8, return_empty_region=False, clip_regions=False
)
paris_districts_result = abr.transform(gdf=stations_gdf)
Loading boundaries: 0: 0%| | 0/314 [00:00<?, ?it/s]
Loading boundaries: 1: 0%| | 0/314 [00:00<?, ?it/s]
Loading boundaries: 2: 0%| | 1/314 [00:00<00:03, 78.64it/s]
Loading boundaries: 3: 1%| | 2/314 [00:00<00:02, 106.83it/s]
Loading boundaries: 4: 1%| | 3/314 [00:00<00:02, 120.42it/s]
Loading boundaries: 5: 1%|▏ | 4/314 [00:00<00:02, 125.21it/s]
Loading boundaries: 6: 5%|▌ | 17/314 [00:00<00:00, 429.49it/s]
Loading boundaries: 7: 7%|▋ | 21/314 [00:00<00:00, 453.43it/s]
Loading boundaries: 8: 13%|█▎ | 40/314 [00:00<00:00, 726.47it/s]
Loading boundaries: 9: 14%|█▍ | 45/314 [00:00<00:00, 719.53it/s]
Loading boundaries: 10: 19%|█▉ | 60/314 [00:00<00:00, 850.58it/s]
Loading boundaries: 11: 26%|██▋ | 83/314 [00:00<00:00, 1042.58it/s]
Loading boundaries: 12: 27%|██▋ | 85/314 [00:00<00:00, 983.39it/s]
Loading boundaries: 13: 27%|██▋ | 86/314 [00:00<00:00, 917.20it/s]
Loading boundaries: 13: 38%|███▊ | 120/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 14: 43%|████▎ | 134/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 15: 50%|█████ | 157/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 16: 65%|██████▍ | 204/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 17: 70%|███████ | 221/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 18: 73%|███████▎ | 228/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 19: 74%|███████▍ | 232/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 20: 75%|███████▍ | 234/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 21: 75%|███████▌ | 236/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 22: 76%|███████▌ | 238/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 23: 77%|███████▋ | 241/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 24: 78%|███████▊ | 246/314 [00:00<00:00, 1199.27it/s]
Loading boundaries: 24: 79%|███████▊ | 247/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 25: 79%|███████▊ | 247/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 26: 80%|███████▉ | 250/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 27: 84%|████████▍ | 263/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 28: 88%|████████▊ | 276/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 29: 91%|█████████ | 286/314 [00:00<00:00, 1234.40it/s]
Loading boundaries: 29: 100%|██████████| 314/314 [00:00<00:00, 1224.41it/s]
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/srai/regionalizers/administrative_boundary_regionalizer.py:171: FutureWarning: `unary_union` returned None due to all-None GeoSeries. In future, `unary_union` will return 'GEOMETRYCOLLECTION EMPTY' instead.
paris_districts_result.head()
geometry | |
---|---|
region_id | |
Châtillon | POLYGON ((2.27988 48.81091, 2.28325 48.81056, ... |
Malakoff | POLYGON ((2.30132 48.82513, 2.31413 48.82226, ... |
Puteaux | POLYGON ((2.25372 48.88691, 2.25244 48.88551, ... |
Neuilly-sur-Seine | POLYGON ((2.24562 48.87636, 2.24777 48.87849, ... |
Paris | POLYGON ((2.23208 48.86951, 2.24046 48.87189, ... |
folium_map = plot_regions(paris_districts_result, tiles_style="CartoDB positron")
stations_gdf.explore(
m=folium_map,
style_kwds=dict(color="#444", opacity=1, fillColor="#f2f2f2", fillOpacity=1),
marker_kwds=dict(radius=1),
)