Skip to content

pycensus.census.worldwide.gba.loader

GlobalBuildingAtlas (GBA): worldwide building footprints with heights (LoD1).

Zhu et al. (2025), "GlobalBuildingAtlas", Earth Syst. Sci. Data 17, 6647 (https://essd.copernicus.org/articles/17/6647/2025/, https://github.com/zhu-xlab/GlobalBuildingAtlas). The data come in 5 x 5 degree tiles named e030_n35_e035_n30 (west, north, east, south edges) under a continent folder, in three parts (all EPSG:3857):

GBA.ODbLPolygon  <continent>/<tile>.geojson           footprints from ODbL sources (OSM, Microsoft)       ODbL
GBA.LoD1         Polygon/<continent>/<tile>.geojson   the other footprints (Google, GBA's own)            CC BY-NC 4.0
GBA.LoD1         LoD1/<continent>/<tile>.json         {source+id+region: {height, var}} for every footprint  CC BY-NC 4.0

(the height rasters, GBA.Height on mediaTUM, are not needed: every footprint already carries its LoD1 height). Mixing the parts has license implications -- see the dataset's README.

from pycensus.census.worldwide.gba import load_buildings
b = load_buildings(aoi, cache_dir)     # GeoDataFrame EPSG:4326: source, id, region, height (m), height_var, footprint_m2

Downloads go to <cache_dir>/gba/... (kept, resumable); the buildings of an AOI are cached as parquet under <cache_dir>/gba/_aoi/.

tile_name(lon, lat)

Name of the 5-degree tile containing (lon, lat), e.g. (34.8, 31.25) -> 'e030_n35_e035_n30'.

Parameters:

Name Type Description Default
lon float

Longitude.

required
lat float

Latitude.

required

Returns:

Type Description
str

The tile name.

tiles_for_bbox(west, south, east, north)

Every tile a WGS84 bounding box touches.

Parameters:

Name Type Description Default
west float

West bound.

required
south float

South bound.

required
east float

East bound.

required
north float

North bound.

required

Returns:

Type Description
List[str]

Tile names.

tile_index(cache_dir=None)

{tile: continent} for every tile GBA publishes (from the HuggingFace folder listings of GBA.LoD1 Polygon/<continent>; cached).

Parameters:

Name Type Description Default
cache_dir

Cache folder; None = the pycensus cache.

None

tile_paths(tile, continent, cache_dir=None)

Local paths of a tile's (ODbL polygons, other polygons, heights) files.

Parameters:

Name Type Description Default
tile str

Tile name.

required
continent str

GBA continent folder.

required
cache_dir

Cache folder; None = the pycensus cache.

None

download_tiles(tiles, cache_dir=None)

Download the three parts of each tile (skipping files already there). Returns [(tile, continent)] for the tiles GBA has.

Parameters:

Name Type Description Default
tiles Iterable[str]

Tile names.

required
cache_dir

Cache folder; None = the pycensus cache.

None

read_heights(json_path, keys, chunk=1 << 26)

{key: (height, var)} for keys from a GBA LoD1 height file (a single JSON object, read in chunks -- the files are ~1 GB).

Parameters:

Name Type Description Default
json_path Path

LoD1 height file.

required
keys set

Building keys wanted.

required
chunk int

Read size in bytes.

1 << 26

load_buildings(aoi, cache_dir=None, clip=True, refresh=False)

Every GBA footprint of aoi with its LoD1 height.

Returns a GeoDataFrame (EPSG:4326): source (osm / ms / google / ...), id, region, height (m; NaN where GBA has none), height_var, footprint_m2 (true area). clip: keep the footprints whose centroid lies inside the AOI polygon (else its bbox).

Parameters:

Name Type Description Default
aoi GeoDataFrame

Area of interest (GeoDataFrame).

required
cache_dir

Cache folder; None = the pycensus cache.

None
clip bool

Keep only footprints inside the AOI polygon.

True
refresh bool

Ignore the cached file.

False