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:01<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:04<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:07<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:12<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:14<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:15<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:17<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:18<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:19<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:21<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:22<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:24<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:25<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:26<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:28<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:29<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:30<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:32<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:33<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:34<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:36<?, ?it/s]
Loading boundaries: 27: 0%| | 0/1 [00:37<?, ?it/s]
Loading boundaries: 28: 0%| | 0/1 [00:38<?, ?it/s]
Loading boundaries: 29: 0%| | 0/1 [00:40<?, ?it/s]
Loading boundaries: 30: 0%| | 0/1 [00:41<?, ?it/s]
Loading boundaries: 31: 0%| | 0/1 [00:42<?, ?it/s]
Loading boundaries: 32: 0%| | 0/1 [00:43<?, ?it/s]
Loading boundaries: 33: 0%| | 0/1 [00:45<?, ?it/s]
Loading boundaries: 34: 0%| | 0/1 [00:46<?, ?it/s]
Loading boundaries: 35: 0%| | 0/1 [00:48<?, ?it/s]
Loading boundaries: 36: 0%| | 0/1 [00:49<?, ?it/s]
Loading boundaries: 37: 0%| | 0/1 [00:51<?, ?it/s]
Loading boundaries: 38: 0%| | 0/1 [00:52<?, ?it/s]
Loading boundaries: 39: 0%| | 0/1 [00:53<?, ?it/s]
Loading boundaries: 40: 0%| | 0/1 [00:55<?, ?it/s]
Loading boundaries: 41: 0%| | 0/1 [00:56<?, ?it/s]
Loading boundaries: 42: 0%| | 0/1 [00:57<?, ?it/s]
Loading boundaries: 43: 0%| | 0/1 [00:58<?, ?it/s]
Loading boundaries: 44: 0%| | 0/1 [01:00<?, ?it/s]
Loading boundaries: 45: 0%| | 0/1 [01:01<?, ?it/s]
Loading boundaries: 46: 0%| | 0/1 [01:02<?, ?it/s]
Loading boundaries: 47: 0%| | 0/1 [01:04<?, ?it/s]
Loading boundaries: 48: 0%| | 0/1 [01:05<?, ?it/s]
Loading boundaries: 48: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:05<00:00, 65.50s/it]
Loading boundaries: 48: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:05<00:00, 65.50s/it]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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:03<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:05<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:06<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:13<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:14<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:16<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:17<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:19<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:20<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:22<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:23<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:25<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:26<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:28<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:29<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:31<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:32<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:34<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:35<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:37<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:38<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:40<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:41<?, ?it/s]
Loading boundaries: 26: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:41<00:00, 41.70s/it]
Loading boundaries: 26: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:41<00:00, 41.70s/it]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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:06<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:12<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:14<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:16<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:18<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:21<?, ?it/s]
Loading boundaries: 9: 0%| | 0/1 [00:24<?, ?it/s]
Loading boundaries: 10: 0%| | 0/1 [00:26<?, ?it/s]
Loading boundaries: 11: 0%| | 0/1 [00:28<?, ?it/s]
Loading boundaries: 12: 0%| | 0/1 [00:30<?, ?it/s]
Loading boundaries: 13: 0%| | 0/1 [00:31<?, ?it/s]
Loading boundaries: 14: 0%| | 0/1 [00:33<?, ?it/s]
Loading boundaries: 15: 0%| | 0/1 [00:35<?, ?it/s]
Loading boundaries: 16: 0%| | 0/1 [00:36<?, ?it/s]
Loading boundaries: 17: 0%| | 0/1 [00:38<?, ?it/s]
Loading boundaries: 18: 0%| | 0/1 [00:40<?, ?it/s]
Loading boundaries: 19: 0%| | 0/1 [00:41<?, ?it/s]
Loading boundaries: 20: 0%| | 0/1 [00:44<?, ?it/s]
Loading boundaries: 21: 0%| | 0/1 [00:46<?, ?it/s]
Loading boundaries: 22: 0%| | 0/1 [00:49<?, ?it/s]
Loading boundaries: 23: 0%| | 0/1 [00:51<?, ?it/s]
Loading boundaries: 24: 0%| | 0/1 [00:53<?, ?it/s]
Loading boundaries: 25: 0%| | 0/1 [00:55<?, ?it/s]
Loading boundaries: 26: 0%| | 0/1 [00:57<?, ?it/s]
Loading boundaries: 27: 0%| | 0/1 [00:59<?, ?it/s]
Loading boundaries: 28: 0%| | 0/1 [01:01<?, ?it/s]
Loading boundaries: 29: 0%| | 0/1 [01:03<?, ?it/s]
Loading boundaries: 30: 0%| | 0/1 [01:05<?, ?it/s]
Loading boundaries: 31: 0%| | 0/1 [01:07<?, ?it/s]
Loading boundaries: 32: 0%| | 0/1 [01:09<?, ?it/s]
Loading boundaries: 33: 0%| | 0/1 [01:11<?, ?it/s]
Loading boundaries: 34: 0%| | 0/1 [01:13<?, ?it/s]
Loading boundaries: 35: 0%| | 0/1 [01:15<?, ?it/s]
Loading boundaries: 36: 0%| | 0/1 [01:17<?, ?it/s]
Loading boundaries: 37: 0%| | 0/1 [01:19<?, ?it/s]
Loading boundaries: 38: 0%| | 0/1 [01:21<?, ?it/s]
Loading boundaries: 39: 0%| | 0/1 [01:22<?, ?it/s]
Loading boundaries: 40: 0%| | 0/1 [01:24<?, ?it/s]
Loading boundaries: 41: 0%| | 0/1 [01:26<?, ?it/s]
Loading boundaries: 42: 0%| | 0/1 [01:28<?, ?it/s]
Loading boundaries: 43: 0%| | 0/1 [01:30<?, ?it/s]
Loading boundaries: 44: 0%| | 0/1 [01:31<?, ?it/s]
Loading boundaries: 45: 0%| | 0/1 [01:33<?, ?it/s]
Loading boundaries: 46: 0%| | 0/1 [01:35<?, ?it/s]
Loading boundaries: 47: 0%| | 0/1 [01:37<?, ?it/s]
Loading boundaries: 48: 0%| | 0/1 [01:39<?, ?it/s]
Loading boundaries: 49: 0%| | 0/1 [01:41<?, ?it/s]
Loading boundaries: 50: 0%| | 0/1 [01:44<?, ?it/s]
Loading boundaries: 51: 0%| | 0/1 [01:46<?, ?it/s]
Loading boundaries: 52: 0%| | 0/1 [01:48<?, ?it/s]
Loading boundaries: 53: 0%| | 0/1 [01:50<?, ?it/s]
Loading boundaries: 54: 0%| | 0/1 [01:52<?, ?it/s]
Loading boundaries: 54: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:52<00:00, 112.22s/it]
Loading boundaries: 54: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [01:52<00:00, 112.22s/it]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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:01<?, ?it/s]
Loading boundaries: 2: 0%| | 0/1 [00:03<?, ?it/s]
Loading boundaries: 3: 0%| | 0/1 [00:04<?, ?it/s]
Loading boundaries: 4: 0%| | 0/1 [00:05<?, ?it/s]
Loading boundaries: 5: 0%| | 0/1 [00:07<?, ?it/s]
Loading boundaries: 6: 0%| | 0/1 [00:08<?, ?it/s]
Loading boundaries: 7: 0%| | 0/1 [00:10<?, ?it/s]
Loading boundaries: 8: 0%| | 0/1 [00:11<?, ?it/s]
Loading boundaries: 8: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:11<00:00, 11.53s/it]
Loading boundaries: 8: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:11<00:00, 11.53s/it]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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, 10.90it/s]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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, 10.95it/s]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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, 10.79it/s]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:169: 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:01<?, ?it/s]
Loading boundaries: 1: 0%|▍ | 1/314 [00:01<09:39, 1.85s/it]
Loading boundaries: 2: 0%|▍ | 1/314 [00:03<09:39, 1.85s/it]
Loading boundaries: 2: 1%|▉ | 2/314 [00:03<09:24, 1.81s/it]
Loading boundaries: 3: 1%|▉ | 2/314 [00:05<09:24, 1.81s/it]
Loading boundaries: 3: 1%|█▍ | 3/314 [00:05<09:35, 1.85s/it]
Loading boundaries: 4: 1%|█▍ | 3/314 [00:07<09:35, 1.85s/it]
Loading boundaries: 4: 1%|█▉ | 4/314 [00:07<10:37, 2.06s/it]
Loading boundaries: 5: 1%|█▉ | 4/314 [00:09<10:37, 2.06s/it]
Loading boundaries: 5: 2%|██▍ | 5/314 [00:09<10:14, 1.99s/it]
Loading boundaries: 6: 5%|████████▏ | 17/314 [00:11<09:51, 1.99s/it]
Loading boundaries: 6: 6%|████████▋ | 18/314 [00:11<01:56, 2.55it/s]
Loading boundaries: 7: 7%|██████████▏ | 21/314 [00:13<01:54, 2.55it/s]
Loading boundaries: 7: 7%|██████████▋ | 22/314 [00:13<02:00, 2.43it/s]
Loading boundaries: 8: 13%|███████████████████▎ | 40/314 [00:15<01:52, 2.43it/s]
Loading boundaries: 8: 13%|███████████████████▊ | 41/314 [00:15<00:56, 4.84it/s]
Loading boundaries: 9: 14%|█████████████████████▊ | 45/314 [00:17<00:55, 4.84it/s]
Loading boundaries: 9: 15%|██████████████████████▎ | 46/314 [00:17<01:05, 4.09it/s]
Loading boundaries: 10: 19%|████████████████████████████▊ | 60/314 [00:19<01:02, 4.09it/s]
Loading boundaries: 10: 19%|█████████████████████████████▎ | 61/314 [00:19<00:51, 4.94it/s]
Loading boundaries: 11: 26%|███████████████████████████████████████▉ | 83/314 [00:21<00:46, 4.94it/s]
Loading boundaries: 11: 27%|████████████████████████████████████████▍ | 84/314 [00:21<00:32, 7.00it/s]
Loading boundaries: 12: 27%|████████████████████████████████████████▉ | 85/314 [00:23<00:32, 7.00it/s]
Loading boundaries: 12: 27%|█████████████████████████████████████████▎ | 86/314 [00:23<00:43, 5.25it/s]
Loading boundaries: 13: 27%|█████████████████████████████████████████▎ | 86/314 [00:25<00:43, 5.25it/s]
Loading boundaries: 13: 28%|█████████████████████████████████████████▊ | 87/314 [00:25<00:58, 3.85it/s]
Loading boundaries: 14: 43%|████████████████████████████████████████████████████████████████ | 134/314 [00:27<00:46, 3.85it/s]
Loading boundaries: 14: 43%|████████████████████████████████████████████████████████████████▍ | 135/314 [00:27<00:18, 9.67it/s]
Loading boundaries: 15: 50%|███████████████████████████████████████████████████████████████████████████ | 157/314 [00:29<00:16, 9.67it/s]
Loading boundaries: 15: 50%|███████████████████████████████████████████████████████████████████████████▍ | 158/314 [00:29<00:15, 10.32it/s]
Loading boundaries: 16: 65%|█████████████████████████████████████████████████████████████████████████████████████████████████▍ | 204/314 [00:31<00:10, 10.32it/s]
Loading boundaries: 16: 65%|█████████████████████████████████████████████████████████████████████████████████████████████████▉ | 205/314 [00:31<00:07, 13.77it/s]
Loading boundaries: 17: 70%|█████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 221/314 [00:33<00:06, 13.77it/s]
Loading boundaries: 17: 71%|██████████████████████████████████████████████████████████████████████████████████████████████████████████ | 222/314 [00:33<00:07, 12.58it/s]
Loading boundaries: 18: 73%|████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 228/314 [00:35<00:06, 12.58it/s]
Loading boundaries: 18: 73%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 229/314 [00:35<00:08, 10.00it/s]
Loading boundaries: 19: 74%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 232/314 [00:37<00:08, 10.00it/s]
Loading boundaries: 19: 74%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 233/314 [00:37<00:10, 7.59it/s]
Loading boundaries: 20: 75%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 234/314 [00:39<00:10, 7.59it/s]
Loading boundaries: 20: 75%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 235/314 [00:39<00:13, 5.71it/s]
Loading boundaries: 21: 75%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 236/314 [00:41<00:13, 5.71it/s]
Loading boundaries: 21: 75%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 237/314 [00:41<00:17, 4.30it/s]
Loading boundaries: 22: 76%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 238/314 [00:43<00:17, 4.30it/s]
Loading boundaries: 22: 76%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 239/314 [00:43<00:22, 3.39it/s]
Loading boundaries: 23: 77%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 241/314 [00:45<00:21, 3.39it/s]
Loading boundaries: 23: 77%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 242/314 [00:45<00:26, 2.72it/s]
Loading boundaries: 24: 78%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 246/314 [00:51<00:25, 2.72it/s]
Loading boundaries: 24: 79%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 247/314 [00:51<00:41, 1.62it/s]
Loading boundaries: 25: 79%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 247/314 [00:54<00:41, 1.62it/s]
Loading boundaries: 25: 79%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 248/314 [00:54<00:54, 1.22it/s]
Loading boundaries: 26: 80%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▍ | 250/314 [00:56<00:52, 1.22it/s]
Loading boundaries: 26: 80%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 251/314 [00:56<00:48, 1.31it/s]
Loading boundaries: 27: 84%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 263/314 [00:58<00:38, 1.31it/s]
Loading boundaries: 27: 84%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 264/314 [00:58<00:19, 2.54it/s]
Loading boundaries: 28: 88%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊ | 276/314 [01:00<00:14, 2.54it/s]
Loading boundaries: 28: 88%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▎ | 277/314 [01:00<00:10, 3.63it/s]
Loading boundaries: 29: 91%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 286/314 [01:02<00:07, 3.63it/s]
Loading boundaries: 29: 91%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 287/314 [01:02<00:06, 4.01it/s]
Loading boundaries: 29: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 314/314 [01:02<00:00, 5.03it/s]
/root/development/srai/srai/regionalizers/administrative_boundary_regionalizer.py:172: 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),
)