Skip to content

Earthquake hazard icon Earthquakes example

Business question

Which earthquakes of magnitude 5.5 or greater have we dispatched a dashboard for in the last 90 days, and how is their severity distributed?

We will answer it end-to-end using the adam.adam_eq_events collection — first from a terminal, then from Python, then in an interactive notebook where you can move the sliders and see the result update live.

Step-by-step from a terminal

1. Find events matching the question

curl -sS -H "Accept: application/geo+json" \ "https://api.adam.geospatial.wfp.org/api/collections/adam.adam_eq_events/items?limit=5&sortby=-mag&filter=mag%20%3E%3D%205.5%20AND%20published_at%20%3E%20TIMESTAMP('2026-01-21T00:00:00')%20AND%20map_created%20%3D%20TRUE" \ | jq '{numberMatched, sample: (.features[0].properties | {published_at, mag, mmi, place, iso3, dashboard_url})}'
{
"numberMatched": 12,
"sample": {
"published_at": "2026-04-06T07:22:42",
"mag": 5.2,
"mmi": null,
"place": "2km N of Tabuelan",
"iso3": "PHL",
"dashboard_url": "https://static.gis.wfp.org/adam_eq/events/.../eq_....jpg"
}
}

Change the date in TIMESTAMP('...') to widen or narrow the window. Without the trailing Z — see Recurring Date Queries for why.

2. Pull down derived products for a single event

Take the id of any feature from above and follow the dynamic fields:

EVENT_ID=<id-from-previous-response>curl -sS -H "Accept: application/geo+json" \ "https://api.adam.geospatial.wfp.org/api/collections/adam.adam_eq_events/items/$EVENT_ID" \ | jq '.properties | {shakemap_url, population_csv_url, shapefile_url, dashboard_url}'

Each URL points to a ready-to-download artefact — ShakeMap raster, population CSV, shapefile bundle, pre-rendered dashboard image. See Fetch Event Outputs for the full pattern.

Python recap

The same flow in ~20 lines, using only the standard library:

import json
import urllib.parse
import urllib.request
from datetime import datetime, timedelta, timezone

BASE = "https://api.adam.geospatial.wfp.org/api"
since = (datetime.now(timezone.utc) - timedelta(days=90)).strftime("%Y-%m-%dT%H:%M:%S")

params = urllib.parse.urlencode({
    "filter": f"mag >= 5.5 AND published_at > TIMESTAMP('{since}') AND map_created = TRUE",
    "sortby": "-mag",
    "limit": 100,
})
url = f"{BASE}/collections/adam.adam_eq_events/items?{params}"
req = urllib.request.Request(url, headers={"Accept": "application/geo+json"})

with urllib.request.urlopen(req) as r:
    fc = json.loads(r.read())

print(f"{fc['numberMatched']} events")
for f in fc["features"][:5]:
    p = f["properties"]
    print(f"  M{p.get('mag'):<4} {p.get('published_at', ''):<20} {p.get('place', '')}")

Interactive — marimo playground

Move the sliders. The API is queried live on every change and results re-render reactively.

Download the notebook source to run locally: earthquakes.py

Try it yourself

Live references

Next steps