What would be the code to easily get all the states (second subdivisions) of a country? The pattern from OSMNX is, more or less:
division | admin_level |
---|---|
country | 2 |
region | 3 |
state | 4 |
city | 8 |
neighborhood | 10 |
For an example, to get all the neighborhoods from a city:
import pandas as pd
import geopandas as gpd
import osmnx as ox
place = 'Rio de Janeiro'
tags = {'admin_level': '10'}
gdf = ox.geometries_from_place(place, tags)
The same wouldn't apply if one wants the states from a country?
place = 'Brasil'
tags = {'admin_level': '4'}
gdf = ox.geometries_from_place(place, tags)
I'm not even sure this snippet doesn't work, because I let it run for 4 hours and it didn't stop running. Maybe the package isn't made for downloading big chunks of data, or there's a solution more efficient than ox.geometries_from_place()
for that task, or there's more information I could add to the tags
. Help is appreciated.