bitbeet.dev
← back to projects
// 04 · govtech

PNR Art. 8 Generator

Official MITECO deliverable generator for the EU Nature Restoration Regulation.


STACK
Python 3.12 · PySide6 (Qt 6) · PyInstaller · rasterio · GDAL · GeoPackage · COG · ISO 19115 · ReportLab · openpyxl
STATUS
live

The EU Nature Restoration Regulation 2024/1991 requires every qualifying Spanish municipality to submit an Article 8 deliverable to MITECO by May 2026. The format is strict: specific Excel workbooks, GeoPackage layers with exact schema, Cloud-Optimized GeoTIFFs, ISO 19115 metadata, a signed PDF memoir, and a ZIP under 20 MB. 1,342 municipalities need it. This project industrialises the whole thing.

The pipeline

PNR Art. 8 generator pipeline: Copernicus rasters and LAU geometry feed a seven-step Python pipeline driven by a Qt wizard or CLI, producing the MITECO-ready deliverable // INPUTS (OFFICIAL SOURCES) Copernicus HRL rasters CLC+ Backbone 2023 DEGURBA · LAU 2024 shapefile Municipal INE + measures // PIPELINE · 7 STEPS 01 · load catalogue 02 · compute EVU / CAU 03 · map measures → categories 04 · build Excel Formato Uniforme 05 · write GeoPackage layers 06 · COG rasters + ISO 19115 07 · assemble ZIP ≤ 20 MB deterministic · byte-identical output zonal-stats via rasterio + GDAL // DRIVER Qt 6 Wizard PySide6 · .exe CLI pnr-art8 build // MITECO DELIVERABLE Excel · Formato Uniforme v20260317 GeoPackage · ZEU · MED · FDC Rásters COG · EVU · CAU ISO 19115 metadata XML Memoria técnica PDF ZIP ≤ 20 MB → bzn-pnr@miteco.es // SCOPE EU Reg. 2024/1991 Art. 8 · 1,342 Spanish municipalities DEGURBA 1-2 · deadline 2026-05-15
official sources · 7-step Python pipeline · Qt or CLI driver · MITECO-shaped deliverable

Seven numbered steps, all deterministic. The same input files and the same municipality INE code always produce a byte-identical ZIP — critical for audit.

  1. Input catalogue — reads Copernicus HRL rasters, CLC+ Backbone, DEGURBA shapefile, LAU 2024 geometry, and the municipal boundary for the given INE.
  2. EVU / CAU computation — computes Urban Ecosystem Area and Tree Canopy Area coverage ratios using zonal statistics over the rasters.
  3. Measure catalogue — loads the municipal measure inventory (medidas de restauración) and maps each to ZEU/MED/FDC categories.
  4. Excel workbook — generates the MITECO Formato Uniforme v20260317 workbook with the computed figures and measure catalogue.
  5. GeoPackage — writes ZEU (Zonas Ecosistema Urbano), MED (Medidas), FDC (Fichas De Compromiso) as separate layers with exact attribute schema.
  6. COG rasters + metadata — exports EVU and CAU as Cloud-Optimized GeoTIFFs plus ISO 19115 metadata XML. Builds the PDF memoir from templated LaTeX/ReportLab.
  7. Pack — assembles the ZIP honoring the 20 MB limit (lossy compression fallback on oversize).

Two front-ends, one package

The heavy lifting lives in pnr_art8/. Everything is reusable both from a QWizard-based desktop app and from a CLI.

# Quick municipality lookup
pnr-art8 info --ine 38023

# Full build (CLI)
pnr-art8 build --ine 38023 --year 2024 \
  --evu ./evu.tif --cau ./cau.tif \
  --medidas ./medidas.gpkg

# Or drive the GUI
pnr-art8-gui

The Qt 6 GUI is a guided wizard: it picks the INE from a searchable catalogue, auto-suggests raster sources from the Copernicus DiscoMap (88 products indexed), runs the pipeline with a progress bar and writes the ZIP into outputs/<INE>/<year>/.

Packaging

Because the target audience is municipal staff, not Python devs, the app ships as a single Windows .exe via PyInstaller. The entire GDAL/rasterio stack plus Qt resources gets baked into one executable. Install is copy-and-paste.

Reference

First real-world run: Ayuntamiento de San Cristóbal de La Laguna (ES38023). Output reproduced 1:1 against the hand-crafted v01 (EVU 40.71 %, CAU 0.46 %, 304 measures, 1.05 MB ZIP). Paradigm of passing an audit check by construction.

License: EUPL-1.2. Target submission channel: bzn-pnr@miteco.es. Deadline: 15 May 2026.


1,342
Spanish municipalities
7
pipeline steps
< 20MB
final ZIP limit