pycensus.census.worldwide.un_metro_areas¶
Official metropolitan-area boundaries for any city in the world, following the United Nations definition.
The UN Statistical Commission endorsed the Degree of Urbanisation method in 2020 (EC, FAO, ILO, OECD, UN-Habitat, World Bank) as the global definition of cities and urban areas. The Global Human Settlement Layer (European Commission, JRC) applies it worldwide, and this module downloads its two boundary products:
"urban_centre"-- the city of the Degree of Urbanisation: contiguous 1 km grid cells of >= 1,500 inhabitants per km2 (or >= 50% built-up) with a total of >= 50,000 inhabitants (GHS-UCDB R2024A, population 2025)."functional_urban_area"-- the metropolitan area: the urban centre plus the surrounding commuting zone (cells sending >= 15% of their workers to the centre) (GHS-FUA, with R2019A boundaries on 2015 population; the only global release of the commuting zone).
Both come back as GeoDataFrames in EPSG:4326 with the same columns (name, country_iso, country, population, area_km2,
kind, source and the product's own id).
from pycensus.census.worldwide import un_metro_areas
un_metro_areas.find("Toronto", country="CAN") # functional urban area by name
un_metro_areas.find(point=(-79.38, 43.65), kind="urban_centre") # the city containing a point
un_metro_areas.load_functional_urban_areas() # all ~9,000 areas
find and for_aoi return solid polygons (no interior rings) unless called with fill_holes=False; separate parts stay separate.
load_urban_centres(cache_dir=None, version='V1-2')
¶
Cities (urban centres) of the Degree of Urbanisation, GHS-UCDB R2024A (population 2025), EPSG:4326.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_dir
|
Optional[str]
|
Cache folder; |
None
|
version
|
str
|
GHS-UCDB version. |
'V1-2'
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
The urban centres. |
load_functional_urban_areas(cache_dir=None)
¶
Metropolitan areas (urban centre + commuting zone), GHS-FUA R2019A (population 2015), EPSG:4326.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_dir
|
Optional[str]
|
Cache folder; |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
The functional urban areas. |
load(kind='functional_urban_area', cache_dir=None)
¶
Functional urban areas ("functional_urban_area") or urban centres ("urban_centre").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
Which layer. |
'functional_urban_area'
|
cache_dir
|
Optional[str]
|
Cache folder; |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
The layer. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For an unknown kind. |
find(name=None, country=None, point=None, kind='functional_urban_area', cache_dir=None, fill_holes=True)
¶
Metro areas matching name (accent/case-insensitive, also against alternative names), country (ISO3 or name) and/or containing
point = (lon, lat). Largest population first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
Name to look for. |
None
|
country
|
Optional[str]
|
ISO3 code or country name. |
None
|
point
|
Optional[Tuple[float, float]]
|
|
None
|
kind
|
str
|
Which layer. |
'functional_urban_area'
|
cache_dir
|
Optional[str]
|
Cache folder; |
None
|
fill_holes
|
bool
|
Remove interior rings. |
True
|
for_aoi(aoi, kind='functional_urban_area', cache_dir=None, fill_holes=True)
¶
Metro areas intersecting an area of interest, with the share of the AOI each covers (aoi_share) and of itself inside the AOI (area_share_in_aoi).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aoi
|
Union[GeoDataFrame, GeoSeries]
|
Area of interest (GeoDataFrame). |
required |
kind
|
str
|
Which layer. |
'functional_urban_area'
|
cache_dir
|
Optional[str]
|
Cache folder; |
None
|
fill_holes
|
bool
|
Remove interior rings. |
True
|
fill_holes(gdf)
¶
Copy of gdf with every interior ring removed, so each part is a solid polygon (parts stay separate: a few areas are multipart islands).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdf
|
GeoDataFrame
|
Polygons. |
required |