Skip to content

pycensus.census.countries.euskadi.eustat.loader

Loader for Euskadi municipal population, returning a common-schema GeoDataFrame.

Technical aspects

Similar to usa.acs.loader, mexico.inegi.loader, and spain.eustat.loader, this module provides a load() function that: 1. Resolves the requested geographic level 2. Determines which territories to load (from AOI or explicit list) 3. Uses the cache system to load only missing columns 4. Fetches boundaries and attribute data as needed 5. Returns a GeoDataFrame with GEOID, geometry, and eustat_prefixed columns

Unlike usa's Census Bureau API, neither of Euskadi's own real data portals (opendata.euskadi.eus, eustat.eus) is reachable over a plain scripted HTTP request -- both returned 403/404 to real curl checks made during this rebuild (see euskadi/geography.py's docstring for the exact checks). This loader therefore sources both geometry and its one real attribute column (population, via euskadi.eustat.schema.SCHEMA) from Eurostat/GISCO's LAU 2021 GeoPackage, which republishes real INE-sourced Spanish municipal boundaries and population -- verified against Gipuzkoa's, Araba's, and Bizkaia's well-documented real populations (see schema.json).

No API key is required for this source.

Source

Eurostat/GISCO LAU 2021: https://gisco-services.ec.europa.eu/distribution/v2/lau/lau-2021-files.html

load(aoi=None, regions=None, level='municipality', year='latest', api_key=None, cache_dir=None, cache=True, data_dir=None)

Load Euskadi municipal population data as a common-schema GeoDataFrame.

Parameters:

Name Type Description Default
aoi Optional[GeoDataFrame]

Area of interest. Used to auto-detect regions if not given, and to clip the final result.

None
regions Optional[Union[str, List[str]]]

Territory name(s)/abbreviation(s)/code(s) to load (Araba, Bizkaia, Gipuzkoa or 01, 48, 20). Derived from aoi if omitted (aoi is then required).

None
level str

Standard geometry level name. Real levels implemented here are autonomous_community, territory, and municipality -- everything finer falls back to municipality via :data:pycensus.euskadi.constants.LEVEL_FALLBACK (see that module's docstring for why).

'municipality'
year Union[int, str]

Vintage year, or "latest" (only 2021, GISCO LAU's vintage, is implemented).

'latest'
api_key Optional[str]

Unused -- no API key is required for this source.

None
cache_dir Optional[str]

Root of pyCensus' parquet cache.

None
cache bool

If False, bypass the cache entirely.

True
data_dir Optional[str]

Unused (kept for interface compatibility).

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID, geometry, and one eustat_-prefixed

GeoDataFrame

column per logical column in :data:pycensus.euskadi.eustat.schema.SCHEMA.

Raises:

Type Description
ValueError

If neither regions nor aoi is given.