ispra-idrogeo brings Italy's official data on landslides and floods
into your code, and tells you how far you can trust it.
The data comes from IdroGEO, the platform
of ISPRA, Italy's national environmental agency. With this library you can:
- download the national landslide inventory and the hazard maps, and keep
them fresh by downloading only what changed;
- ask for the risk figures of any region, province or town;
- check a place: is this point in a hazard area? Which landslides are near?
- find the landslides with a date, and how precise that date is;
- know how far to trust the data in each town, and say what is not measured;
- write a report on a town in Italian, and a digest of what changed;
- put it on a map for a town's website, or give it to an AI agent
that checks its own numbers.
No browser, no account, no API key. It reads no rain and gives no alert:
for warnings, follow the bulletins of the Civil Protection.
async with IdroGEO() as idrogeo:
folder = await idrogeo.fetch(opendata("frane_piff")) # 721,457 landslides, one point each
In one picture
flowchart LR
I["🏛️ ISPRA IdroGEO<br/>landslide inventory · hazard maps<br/>risk figures · events"] --> L["📦 ispra-idrogeo<br/>download · ask · check a place<br/>dated landslides · how far to trust"]
L --> Y["🧑💻 Your work<br/>notebooks · GIS · SQL"]
L --> M["🗺️ Mappa dei dati<br/>a page for a town's site"]
L --> R["📝 Reports and digests<br/>idrogeo report · idrogeo digest"]
L --> A["🤖 AI agents<br/>answers with sources, checked numbers"]
L --> X["🛰️ Limen<br/>joins it with rain and thresholds"]
Jump to what you need
| I want to… |
Example |
| download a layer and open it |
Quick start |
| use the command line |
From the command line |
| start everything in Docker with one command |
Run it in containers |
| put a map on a municipality's site |
A map for public bodies |
| write a report on a town, in Italian |
A report for one municipality |
| know what changed since last week |
A digest of what changed |
| check the numbers of a text or an AI answer |
Check a text for invented numbers |
| know if a place is in a hazard area |
Hazard at a point |
| find the landslides near a place |
Landslides near a point |
| get the risk figures of a town |
Ask the API · Every municipality |
| count landslides by region |
Landslides per region |
| search landslides and events |
Walk through every landslide or event |
| use dated landslides (rainfall thresholds) |
Dated landslides |
| know how far to trust IFFI in a place |
How far to trust the data |
| know when ISPRA last changed a file |
Freshness |
| keep a copy fresh every night |
Keep a national copy fresh · Only what changed · Watch |
| turn codes into words |
Translate the codes |
| put API rows on a map |
API rows on a map |
| work offline, in SQL |
A local warehouse |
| give the data to an AI agent |
Answers with their source |
| know where AI helps, and use my Anthropic key |
AI: where it helps |
| check that everything works |
Test notebook · Known cases |
| credit the data correctly |
Data licence and credits |
Contents
- What is IdroGEO, in 30 seconds
- What this library does
- Who is it for
- Quick start
- What you can download
- Where downloads are saved
- A map for public bodies
- Run it in containers
- How it works
- Recipes
- Example notebooks
- AI: where it helps
- The traps we already fell into
- Known cases
- API at a glance
- Contributing · Ideas to work on
- Data licence and credits
What is IdroGEO, in 30 seconds
Italy is one of the European countries most exposed to landslides and floods.
Three things are known about them, and IdroGEO publishes all three:
- Where landslides happened. For decades ISPRA and the regions have
mapped every landslide they found into one national inventory, IFFI
(Inventario dei Fenomeni Franosi in Italia).
- Where the ground may slide or rivers may flood. The river basin
authorities draw hazard maps, the PAI plans, in classes from P1
(low) to P4 (very high). ISPRA joins them into national mosaics.
- Who and what is exposed. From those maps and the census, ISPRA counts
the people, buildings and cultural heritage in each hazard class, town by
town.
flowchart LR
R["🗺️ Regions and<br/>basin authorities<br/>surveys · PAI plans"] --> I["ISPRA<br/>IFFI inventory<br/>national mosaics<br/>risk indicators"]
I --> W["IdroGEO<br/>open data (daily ZIPs)<br/>REST API · map service"]
W -->|ispra-idrogeo| Y["📁 Shapefiles / GeoJSON<br/>on your disk"]
W -->|ispra-idrogeo| J["🧾 JSON<br/>risk figures, code lists"]
Y --> U["Your work<br/>GIS · models · dashboards"]
J --> U
Some of what is in there, straight from the API:
| Italy, November 2026 |
|
| Landslides mapped in IFFI |
721,457 |
| … of which with a date |
28,076 (3.9%), 10,822 to the day |
| Land in high or very high landslide hazard (PAI 2024, P3 + P4) |
9.5 % of the country, 28,801 km² |
| People living there |
1.28 million |
| People living in areas that can flood once in 100–200 years (P2) |
6.8 million, 11.5 % of the population |
| Dated landslide events since 2018 (open-data file) |
1,710 |
What this library does
|
What |
In plain words |
| 📦 |
Every open-data file |
The landslide points, outlines and lines, areas of many small landslides, deep-seated deformations, dated events, reports, the hazard maps (landslides 2020-21 and 2024, floods 2020), the monitoring readings. For Italy, a region or a province. |
| 🔁 |
Download once, then only what changed |
Files go to a folder that stays. The next run asks IdroGEO "changed?" and gets a short "no" when nothing did. Never half a file, even at 1.2 GB. |
| 📊 |
Risk figures |
Landslide counts, hazard areas, people, buildings and heritage exposed, for Italy, regions, provinces and all 7,899 towns. |
| 📍 |
Check a place |
The hazard class of a point, its town and slope; the landslides around it, nearest first. One request, no big download. |
| 📅 |
Landslides with a date |
dated_landslides: every dated landslide of IFFI and the events, with how precise its date (hour, day, interval) and its point are. |
| 🧭 |
How far to trust the data |
reliability: for every town, how many landslides are dated, how recently the records were touched, and what nobody measured. |
| 🕒 |
How fresh the data is |
freshness: when ISPRA last changed each file, without downloading it. |
| 📝 |
A report on a town |
idrogeo report Sarno: a page in Italian with hazard, exposure, landslides, trust and sources, from a template; every number checked against the data. |
| 📰 |
What changed |
idrogeo digest: the files, landslide records and events changed since the last digest, by region. |
| 🗺️ |
A map for a town's site |
The Mappa dei dati: hazard, landslides, exposure and trust for one town, in Italian, in Docker. |
| 🤖 |
For AI agents |
ispra_idrogeo.facts: one call per question, each answer with its source and licence, ANSWER_RULES for the model, and check_answer to find invented numbers and numbers said of the wrong thing. |
| ✅ |
Checked |
100% test coverage, known cases and a faithfulness benchmark replayed in CI, the live service tested every day. |
One dependency for the core: httpx.
Who is it for
- Researchers and students in geology, hydrology and civil engineering who
want IFFI or PAI in a notebook, and need to know which landslides have a
date.
- GIS analysts and data engineers who keep a copy of the national layers
fresh every night without downloading 3 GB every night.
- Municipalities and public bodies that want a page on their site with
what the official data says about their territory.
- Civil protection, planning and infrastructure teams who need the figures
of a town, a province or a region, from a script.
- Journalists and civic-tech projects telling the story of landslides and
floods with numbers you can check.
It started inside Limen,
a multi-hazard risk monitor for Italy, and was extracted so that anyone can
use it. The libraries do not depend on one another: only Limen joins them.
flowchart TB
subgraph data["Open data"]
direction LR
I["ISPRA IdroGEO<br/>landslides · hazard"]
D["Civil Protection radar<br/>rain"]
end
subgraph libs["Libraries, each on its own"]
direction LR
L["ispra-idrogeo<br/>where, and how far to trust"]
R["dpc-radar<br/>how much it rained"]
T["rainfall-thresholds<br/>is this rain enough?"]
end
I --> L
D --> R
L --> X["Limen<br/>joins them: risk, town by town"]
R --> X
T --> X
X -.-> B["The official alert stays<br/>the Civil Protection bulletin"]
Quick start
1. Install
pip install ispra-idrogeo # downloads, API, the idrogeo command
pip install "ispra-idrogeo[geo]" # + GeoDataFrames and GeoParquet (geopandas, pyarrow)
pip install "ispra-idrogeo[warehouse]" # + a local DuckDB copy, offline and in SQL
Python 3.12 or newer. No account and no API key: IdroGEO open data is public.
2. Download your first layer
import asyncio
from ispra_idrogeo import IdroGEO, opendata
async def main() -> None:
async with IdroGEO() as idrogeo:
folder = await idrogeo.fetch(opendata("frane_piff", "molise"))
print(folder) # ~/.cache/ispra-idrogeo/frane_piff_molise_opendata
print(sorted(p.name for p in folder.iterdir()))
# ['frane_piff_opendataPoint.cst', '….dbf', '….prj', '….shp', '….shx']
asyncio.run(main())
That's it: a shapefile with the 23,949 landslides mapped in Molise, one point
each. Run it again and it costs one 304 Not Modified.
3. Look at it
With pip install "ispra-idrogeo[geo]" matplotlib:
from ispra_idrogeo.geo import add_labels, read
labels = await idrogeo.code_labels(["tipo_movim"]) # inside the `async with` above
landslides = add_labels(read(folder), labels) # the folder from step 2
print(landslides.crs) # EPSG:32632 (WGS 84 / UTM 32N)
print(landslides["tipo_movim_label"].value_counts().head(3))
# slow earth flow 9168
# complex 7606
# rotational/translational slide 4279
landslides.plot(column="tipo_movim_label", markersize=1, legend=True, figsize=(10, 8))
landslides.to_parquet("molise.parquet") # GeoParquet, for DuckDB, QGIS, BigQuery…
Each point carries the landslide's IFFI id (id_frana), its type of movement
(tipo_movim, nome_tipo), and the region, province, municipality and river
basin district it falls in.
3b. Or from the command line
idrogeo init # the national data, once: see below
idrogeo fetch frane_piff --area molise # prints the unpacked folder
idrogeo summary pir comuni 72006 | jq .popidp2_p # 1.278
idrogeo municipalities --max-age-days 30 > comuni.jsonl
idrogeo municipalities --region 16 > puglia.jsonl # only Puglia's 257
idrogeo landslides --since 2026-11-01T00:00:00Z --select '*' > changed.jsonl
idrogeo landslides --municipality 65135 # Sarno's 53 landslides
idrogeo sites --filter stato_monitoraggio=eq.1 --select uid,point
idrogeo labels tipo_movimento --lang it
idrogeo hazard 40.829 14.617 # P4, Sarno, 12.3°
Downloads print the path they wrote, with a progress bar on stderr when it is
a terminal (--progress / --no-progress to choose); everything else prints JSON, one object
per line for lists (JSON Lines), ready for jq, a file or a database loader.
idrogeo --help and idrogeo <command> --help list every option. An error
prints one line on stderr and exits with status 1.
4. Ask the API
async with IdroGEO() as idrogeo:
bari = await idrogeo.summary("pir", "comuni", 72006) # ISTAT code of Bari
print(bari["nome"], bari["pop_res021"], bari["popidp2_p"])
# Bari 315948 1.278 → 1.3 % of residents in flood hazard P2