Skip to content

pycensus.census.countries.germany.geography

Boundary fetching for Germany census, backed by real Eurostat/GISCO NUTS data.

Technical aspects

Boundaries come from Eurostat/GISCO's NUTS (Nomenclature of Territorial Units for Statistics) geojson distribution -- a real, keyless, verified source (see :data:pycensus.germany.constants.GISCO_NUTS_GEOJSON_URL). Verified live 2026-08-19: NUTS level 0/1/3, filtered to CNTR_CODE == "DE", returned exactly 1 nation / 16 state / 401 district feature -- the real, documented counts of Germany's administrative divisions -- and Hamburg's real NUTS1 geometry (DE6) has bounds matching Hamburg's real coordinates.

Levels map to NUTS levels as: nation -> LEVL_0, state -> LEVL_1, district -> LEVL_3 (Germany's Kreise are NUTS3, not NUTS2). municipality (Gemeinde) has no real boundary source wired up yet -- requesting it raises NotImplementedError rather than fabricating placeholder geometry (see :data:IMPLEMENTED_LEVELS).

Downloaded NUTS geojson is cached on disk (one file per level) under <data_dir>/raw/gisco_nuts/, independent of :mod:pycensus.cache's parquet cache.

Source

https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts

municipality_population(data_dir=None)

Return {GEOID, LAU_NAME, POP_2021} for every German municipality.

Real GISCO LAU population (see :data:GISCO_LAU_GEOJSON_URL), used by :mod:pycensus.census.countries.germany.destatis.loader for the municipality level -- unlike nation/state/district, this does not require a GENESIS-Online account since GISCO already publishes the population figure alongside the boundary.

Parameters:

Name Type Description Default
data_dir Optional[str]

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

None

load_boundaries(level, region=None, year=2021, erase_water=None, data_dir=None)

Fetch real GISCO NUTS boundaries for one Germany geography level.

Parameters:

Name Type Description Default
level str

Standard geometry level name, resolved through :data:pycensus.germany.constants.LEVEL_FALLBACK.

required
region Optional[str]

A state name/abbreviation/code. If given for state, filters to that one state; if given for district, filters to districts within that state (by NUTS1 prefix). Ignored for nation.

None
year int

Vintage year. Kept for interface parity; GISCO NUTS 2021 is the only vintage wired up.

2021
erase_water Optional[bool]

Whether to clip inland water bodies. Defaults to :data:ERASE_WATER for the resolved level. Not yet implemented (GISCO NUTS geometries are land-only administrative boundaries already, so this is a no-op today).

None
data_dir Optional[str]

Root directory for the raw GISCO cache. Defaults to :data:pycensus.germany.constants.DEFAULT_DATA_DIR.

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame with a GEOID column (NUTS code), geometry, in EPSG:4326.

Raises:

Type Description
ValueError

If level resolves to a level without a real, verified boundary source (e.g. municipality).

district_names(data_dir=None)

Return {NUTS3 GEOID: NUTS_NAME} for every German district.

Real GISCO NUTS_NAME property (see :func:_load_germany_nuts), used by :mod:pycensus.census.countries.germany.destatis.crosswalk to build a real, name-matched AGS-to-NUTS3 crosswalk -- do not guess this mapping arithmetically (see that module's docstring for why).

Parameters:

Name Type Description Default
data_dir Optional[str]

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

None

states_in_aoi(aoi, year=2021, data_dir=None)

Return the 2-letter state codes of every German state intersecting aoi.

Parameters:

Name Type Description Default
aoi GeoDataFrame

Area of interest (GeoDataFrame).

required
year int

Boundary year.

2021
data_dir Optional[str]

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

None

Returns:

Type Description
List[str]

State codes.