UrbanViable’s scoring model operates entirely on open public data. Four datasets are downloaded to the developer workstation before each ETL run: the CNIG census section geometries that form the spatial base layer, the INE Atlas de Renta that quantifies purchasing power, the Geofabrik OpenStreetMap extract that captures commercial activity density, and the Catastro vectorial files that characterise the building stock. Together they produce the 11-columnDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/danizd/urbanviable/llms.txt
Use this file to discover all available pages before exploring further.
galicia_scouting.geojson consumed by the frontend.
Sources summary
| # | Source | Provider | Local path | Format | Variables generated |
|---|---|---|---|---|---|
| 1 | Secciones Censales | CNIG / INE | etl/data/secciones_censales/ | Shapefile (ZIP) | Geometry, cusec, poblacion_abs, densidad_norm |
| 2 | Atlas de Renta | INE | etl/data/renta.csv | Long-format CSV | renta_abs, renta_norm |
| 3 | OpenStreetMap Galicia | Geofabrik / OSM | etl/data/galicia-260424.osm.pbf | PBF (binary) | actividad_abs, actividad_norm |
| 4 | Catastro Vectorial | Sede Electrónica del Catastro | etl/data/catastro/[provincia]/ | ZIP per municipality | uso_comercial_norm, antiguedad_norm |
0.0 for the affected columns.
1. CNIG Secciones Censales
URL: https://www.ine.es/dyngs/DAB/index.htm?cid=1389Local path:
etl/data/secciones_censales/Format: Shapefile compressed in a ZIP archive This dataset is the geometric backbone of the project. Every other data source is a table of attributes that gets joined onto it. Each row represents one census section (sección censal) — the smallest administrative unit for which INE publishes socio-economic statistics in Spain. Galicia has approximately 3,800 census sections distributed across its four provinces.
Coordinate reference system
| Stage | CRS | EPSG code |
|---|---|---|
| Original Shapefile | ETRS89 / UTM zone 29N | 25829 or 25830 |
| Area calculation | ETRS89 / UTM zone 30N | 25830 (metric, for area_km2) |
| Output GeoJSON | WGS 84 | 4326 (required by Tippecanoe and MapLibre GL) |
Area is calculated before reprojecting to WGS 84. Working in a metric CRS (ETRS89 UTM) avoids the angular-unit distortion that would result from computing area in degrees.
The CUSEC identifier
Every census section is uniquely identified by a 10-digit code called CUSEC. The ETL usescusec (lowercase) as the join key throughout.
| Segment | Digits | Meaning | Example |
|---|---|---|---|
CCPP | 2 | Province code | 15 = A Coruña |
MMM | 3 | Municipality code | 001 = Abegondo |
DDD | 3 | District code | 001 |
SS | 2 | Section code | 01 |
| Full CUSEC | 10 | Unique section ID | 1500100101 |
15 (A Coruña), 27 (Lugo), 32 (Ourense), 36 (Pontevedra).
The ETL filters non-Galicia sections at load time:
2. INE Atlas de Renta de los Hogares
URL: https://www.ine.es/dynt3/inebase/index.htm?padre=12385&capsel=12384Local path:
etl/data/renta.csvFormat: Long-format CSV (statistical pivot, not a flat table) The INE Atlas de Renta publishes mean household net income at census-section level. It is the primary proxy for purchasing power in the scoring model.
CSV structure
The file is not a directcusec → income table. It is a long-format statistical export where each row represents a (location × indicator × year) combination:
parse_cusec_ine():
Known issues
Suppressed data for small sections. The INE suppresses income values for sections with fewer than 100 households. These appear as"." or blank in the CSV. The ETL treats them as NaN and replaces them with 0 before normalisation:
renta_norm = 0.0. If a high proportion of sections (>20%) fall at zero, the quality check in validate_output() will print a warning.
Variables generated
| Column | Type | Description |
|---|---|---|
renta_abs | integer | Mean household net income in euros (raw value) |
renta_norm | float [0,1] | Min-Max normalised over all Galicia sections |
3. OpenStreetMap Galicia (Geofabrik extract)
URL: https://download.geofabrik.de/europe/spain/galicia.htmlLocal path:
etl/data/galicia-260424.osm.pbfFormat: OSM Protocol Buffer Format (compressed binary) The Geofabrik extract provides the geographic distribution of commercial activity across Galicia: shops, restaurants, services, offices, and other economic nodes. This enables calculation of business density per census section — a proxy for commercial vitality. The OSM PBF file (~200 MB) can be downloaded directly using
download_data.py:
Processing library: osmium
osmium is installed as a dependency of pyrosm, which is listed in requirements.txt. Running pip install -r requirements.txt is sufficient — no separate install step is needed.
The POIHandler class (a subclass of osmium.SimpleHandler) iterates over every OSM node and filters those that carry commercial tags:
Log normalisation
Because commercial activity follows a power-law distribution (most sections have few establishments, but urban centres have hundreds), the ETL applies log normalisation to prevent saturation in the colour scale:Variables generated
| Column | Type | Description |
|---|---|---|
actividad_abs | integer | Number of commercial establishments in the section |
actividad_norm | float [0,1] | Business density normalised on a logarithmic scale |
4. Catastro Vectorial (Sede Electrónica del Catastro)
URL: https://www.sedecatastro.gob.es/DescargaDatos/SECFormularioDescargas.aspxLocal path:
etl/data/catastro/[provincia]/Format: One ZIP file per municipality, each containing multiple Shapefile layers The Catastro vectorial data characterises the urban fabric of each census section: what proportion of the building stock has commercial or office use, and how modern the buildings are. Galicia has ~300 municipalities, so this source is downloaded and stored as a collection of ZIP files organised by province.
Directory structure
Building use codes
ThecurrentUse (or CONSTRU) field in the building layer can follow various classification schemes depending on the Catastro file format. The ETL’s is_commercial() function classifies a building as residential (and excludes it from the commercial ratio) only if its code matches one of the explicit residential codes below. Any other value — including mixed-use codes that contain + — is counted as commercial:
| Residential code | Meaning |
|---|---|
I | Residential (single dwelling) |
II | Residential (collective dwelling) |
III | Residential (other) |
P | Parking / garage |
PI | Parking integral to building |
ratio_comercial.
Building age
Thebeginning (or FECHAALTA) field contains a construction date string. The ETL extracts the 4-digit year and stores it directly as modernidad. Because Min-Max normalisation is applied afterwards, higher mean construction years map to higher antiguedad_norm values — more recently built sections score highest.
Data volume: Processing all ~300 municipality ZIPs can take several hours on a standard laptop. For validation runs, process only the 20 largest municipalities first. The ETL iterates over
CATASTRO_DIR.rglob("*.ZIP"), so placing only a subset of ZIPs in the directory is a valid strategy.Variables generated
| Column | Type | Description |
|---|---|---|
uso_comercial_norm | float [0,1] | Proportion of buildings with commercial/office use, normalised |
antiguedad_norm | float [0,1] | Building stock recency normalised — higher = newer buildings |
5. IGE Population data (jovenes_norm, mayores_norm)
URL: https://www.ige.gal/igebdt/selector.jsp?COD=6057&idioma=esSelector:
6057 — Indicadores de poboación. Datos por seccións censaisLocal path:
etl/data/poblacion_ige.csvFormat: CSV The IGE (Instituto Galego de Estatística) publishes population indicators broken down to census-section level. The ETL uses two demographic percentages:
- % jóvenes — share of the population under 20 years old
- % mayores — share of the population over 64 years old
jovenes_norm; pharmacies filter for mayores_norm).
The file is located at etl/data/poblacion_ige.csv. The ETL identifies CUSEC values by looking for 10-digit all-numeric codes in the third column, then searches for Galician-language indicator substrings ("menor de 20 anos", "maior de 64 anos") in the fourth column.
Variables generated
| Column | Type | Description |
|---|---|---|
jovenes_norm | float [0,1] | % population under 20, Min-Max normalised |
mayores_norm | float [0,1] | % population over 64, Min-Max normalised |
Data licences
| Source | Licence | Required attribution |
|---|---|---|
| CNIG / INE — Secciones Censales | CC BY 4.0 | ”Fuente: IGN / INE” |
| INE — Atlas de Renta | Free reuse (Ley 37/2007) | “Fuente: INE” |
| IGE — Población | Public domain (Xunta de Galicia) | “Fonte: IGE — Instituto Galego de Estatística” |
| OpenStreetMap | ODbL 1.0 | ”© OpenStreetMap contributors” |
| Catastro Vectorial | Free reuse (RD 663/2007) | “Fonte: Sede Electrónica do Catastro” |
HowToUsePage.