pycensus.census.worldwide.gba.metrics¶
Building metrics from GBA footprints, per h3 cell, per polygon or per raster pixel.
Per building: height (m), footprint_m2, built_m2 = footprint_m2 x height / 3 (floor area, one floor per 3 m). A footprint without
a GBA height takes the median height of the footprints of its h3 res-8 cell (or of the whole set) -- fill_heights.
Per zone (a building belongs to the zone holding its centroid), with the global-schema names:
buildingCount number of footprints
buildingFootprintArea sum of footprint_m2
builtFloorArea sum of built_m2
buildingHeightMax / Median max / footprint-area-weighted median of height
buildingFootprintMax / Median max / footprint-area-weighted median of footprint_m2
builtFloorAreaMax / Median max / footprint-area-weighted median of built_m2 (per building)
fill_heights(b, resolution=8)
¶
Copy of b with height filled where GBA has none (median of its res-resolution h3 cell, else of all), height_filled flag,
and built_m2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
GeoDataFrame
|
GBA buildings. |
required |
resolution
|
int
|
H3 resolution of the medians. |
8
|
zone_metrics(b, zone)
¶
METRIC_COLUMNS per zone id (zone: one id per building, NaN = outside every zone). b needs height, footprint_m2, built_m2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
GeoDataFrame
|
Buildings with heights and areas. |
required |
zone
|
Series
|
Zone id per building. |
required |
h3_metrics(b, resolution)
¶
METRIC_COLUMNS per h3 cell (index: cell id) at resolution, buildings by centroid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
GeoDataFrame
|
Buildings with heights and areas. |
required |
resolution
|
int
|
H3 resolution. |
required |
polygon_metrics(b, polygons, id_col)
¶
METRIC_COLUMNS per polygon (index: polygons[id_col]), buildings by centroid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
GeoDataFrame
|
Buildings with heights and areas. |
required |
polygons
|
GeoDataFrame
|
Zones. |
required |
id_col
|
str
|
Zone id column. |
required |
built_area_raster(b, template_tif, out_tif=None, column='built_m2')
¶
Sum of column per pixel of template_tif's grid (e.g. the WorldPop raster), buildings by centroid. Returns (array, profile).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
GeoDataFrame
|
Buildings with |
required |
template_tif
|
str
|
Raster whose grid is used. |
required |
out_tif
|
Optional[str]
|
Optional output GeoTIFF. |
None
|
column
|
str
|
Column summed. |
'built_m2'
|