Skip to content

pycensus.census.countries.spain.catastro.loader

Catastro buildings aggregated to census sections: building counts, dwellings, floor area and construction-year statistics.

Technical aspects (verified 2026-10-25): * STATE Catastro (Direccion General del Catastro), every province EXCEPT 01 Araba, 20 Gipuzkoa, 31 Navarra, 48 Bizkaia (foral cadastres): ATOM index https://www.catastro.hacienda.gob.es/INSPIRE/Buildings/ES.SDGC.BU.atom.xml -> one feed per territorial office (http://www.catastro.hacienda.gob.es/INSPIRE/buildings/<PP>/ES.SDGC.bu.atom_<PP>.xml) -> one zip per municipality (.../Buildings/<PP>/<MMMMM>-<NAME>/A.ES.SDGC.BU.<MMMMM>.zip, e.g. Abejar: 0.17 MB; contains *.building.gml, *.buildingpart.gml, *.otherconstruction.gml). Updated twice a year, free reuse with attribution (D.G. del Catastro). INSPIRE BU model, EPSG:25830/25829/25828/32628. Per building: dateOfConstruction/beginning (year), currentUse (1_residential, 2_agriculture, 3_industrial, 4_1_office, 4_2_retail, 4_3_publicServices), numberOfDwellings, numberOfBuildingUnits, value (gross floor area m2, officialAreaReference grossFloorArea). * ARABA: https://geo.araba.eus/atom/BU/Buildings.atom -> ONE zip (EPSG:4258, 11.5 MB) with a GML per municipality (INSPIRE BU, CC BY 4.0; Vitoria alone has 24,281 buildings). Year in dateOfConstruction/anyPoint, numberOfDwellings, numberOfBuildingUnits, floors; value is the building HEIGHT in m (not a floor area), no use. * NAVARRA: https://filescartografia.navarra.es/2_CARTOGRAFIA_TEMATICA/2_7_CATASTRO/2_7_3_INSPIRE_ATOM/2_7_3_2_BU/Buildings_ServiceATOM_Navarra.xml -> one GML zip per municipality (.../files/BU_Navarra_<n>.gml.zip, ~0.02 MB for a village; CC BY 4.0, SITNA): beginning year (1900 is the default), dwellings, units, floors, value = height (m). * BIZKAIA: https://apli.bizkaia.eus/apps/Danok/INSPIRE/buildings.xml (listed in atom.xml) -> one zip per municipality (ES.BFA.BU.<NNN>.zip, e.g. Amorebieta 0.49 MB; EPSG:4258): construction year in dateOfConstruction/end (spread 1900-2020, plausible), floors and building units; no dwellings, use or floor area. * GIPUZKOA: Diputacion Foral B5M open dataset https://b5m.gipuzkoa.eus/datasets/GFA_DSET_BU_SHP.zip (25 MB, 159,815 polygons, EPSG:25830, updated 2026-10): ONLY footprint, average/maximum height, construction date (41 % of buildings) and type (building / other covered structure); NO use, dwellings or gross floor area (those columns are NaN there). Open licence, attribution "Gipuzkoako Foru Aldundia". * BIZKAIA: ATOM/WFS INSPIRE buildings exist (https://www.bizkaia.eus/es/inspirebizkaia) but no download endpoint was verified; not implemented. Method: each building's centroid is assigned to the census section polygon that contains it (centroids outside every section are dropped). Raw downloads are cached under <data_dir>/raw/catastro/ (never in git).

source_of_province(province)

state | araba | navarra | gipuzkoa | bizkaia (bizkaia: not implemented).

Parameters:

Name Type Description Default
province str

2-digit province code.

required

Returns:

Type Description
str

The cadaster source.

aggregate(buildings, sections)

Aggregate a building frame (lon/lat centroid + attributes) to the GEOID polygons of sections (any CRS).

Parameters:

Name Type Description Default
buildings DataFrame

Buildings with lon / lat.

required
sections GeoDataFrame

Census sections (GEOID + polygons).

required

Returns:

Type Description
DataFrame

One row per section.

load_attributes(province, sections, data_dir=None)

GEOID + the catastro_* columns of FEATURES for the census sections (columns GEOID + polygons) of ONE province.

Downloads (and caches) every municipality of the province for the state feeds: the cadastre's municipality codes are its own (not INE's), so the join to sections is purely spatial.

Parameters:

Name Type Description Default
province str

2-digit province code.

required
sections GeoDataFrame

Census sections of that province.

required
data_dir Optional[str]

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

None

Returns:

Type Description
DataFrame

One row per section.