Skip to content

pycensus.census.countries.germany.zensus_grid.loader

Loader for Destatis' Zensus 2022 100m x 100m INSPIRE population grid.

Technical aspects

Real, keyless, live-downloadable source (verified live 2026-08-22): https://www.destatis.de/static/DE/zensus/gitterdaten/Zensus2022_Bevoelkerungszahl.zip, linked from the official Zensus 2022 results page (https://www.zensus2022.de -> "Ergebnisse des Zensus" -> "Gitterdaten"/100m-Gitter). The zip (~18.5MB) contains real semicolon-delimited CSVs at three resolutions (100m/1km/10km); this module uses the 100m file, Zensus2022_Bevoelkerungszahl_100m-Gitter.csv (153MB uncompressed, 3,088,037 real data rows, header GITTER_ID_100m;x_mp_100m;y_mp_100m;Einwohner).

Each row is one populated 100m grid cell: GITTER_ID_100m encodes the cell's south-west corner in EPSG:3035 (ETRS89-LAEA Europe, the real INSPIRE grid CRS) as CRS3035RES100mN<northing>E<easting>; x_mp_100m/y_mp_100m are the real cell-center coordinates in the same CRS (verified: always corner + 50m); Einwohner is the real 2022-05-15 census population count for that cell.

Verified live 2026-08-22: summing all 3,088,037 real cell populations gives 82,570,995 -- about 2.1% below Zensus 2022's official published national total (84,358,845). This gap is NOT a fabrication/sourcing problem: German gridded Zensus output applies statistical disclosure control (small-cell rounding/suppression) to protect privacy in sparse rural cells, a real, documented, publicly known property of this dataset family (also true of the 2011 Zensus grid) -- individual sparse cells are rounded or dropped, so the grid's summed total is always a slight undercount relative to the official aggregate figure. This is expected behavior, not a data-quality defect introduced here.

This is NOT wired as a pycensus administrative level (unlike nation/state/district/municipality) -- 100m grid cells are not an administrative hierarchy, they're a raster-like point/cell grid, the same architectural shape as :mod:pycensus.census.worldwide.worldpop. Like that module, this loader returns a GeoDataFrame of real grid cells (not raster bands, since Destatis ships this as tabular CSV, not GeoTIFF) for a caller to resample onto an H3 grid or any other target geometry itself -- it is not resampled here.

The raw CSV is cached under <data_dir>/raw/zensus_grid/ (a persistent disk cache of the unzipped file), and a filtered/converted GeoParquet subset is cached per-AOI-bbox under the same directory to avoid re-parsing the full 153MB file on every call.

download_grid(data_dir=None)

Return every real German 100m Zensus 2022 grid cell as 100m x 100m polygons.

On first call, downloads and unzips the real Destatis CSV (~153MB) and caches a parsed GeoParquet version (<data_dir>/raw/zensus_grid/de_zensus_grid_100m.parquet) for fast reuse. Every cell polygon is built from the real x_mp_100m/y_mp_100m cell-center coordinates (EPSG:3035), offsetting +/-50m on each axis, then reprojected to EPSG:4326.

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID (GITTER_ID_100m), population

GeoDataFrame

(Einwohner), and geometry (100m square polygon, EPSG:4326).

Parameters:

Name Type Description Default
data_dir Optional[str]

Folder of the raw downloads; None = the pycensus cache.

None

load(aoi=None, data_dir=None)

Return real Zensus 2022 100m grid cells intersecting aoi.

Parameters:

Name Type Description Default
aoi

A GeoDataFrame/GeoSeries defining the area of interest. If omitted, returns every German grid cell (3,088,037 rows -- large; prefer passing an aoi).

None
data_dir Optional[str]

Root directory for the raw/cached grid. Defaults to :data:DEFAULT_DATA_DIR.

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID, population, geometry (EPSG:4326).

load_extra(aoi=None, data_dir=None)

The base population grid cells in aoi joined with every EXTRA_TABLES column (destatis_* schema names, no prefix).

Parameters:

Name Type Description Default
aoi

Area of interest (GeoDataFrame).

None
data_dir Optional[str]

Folder of the raw downloads; None = the pycensus cache.

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame of the cells.