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
{
"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:
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
- Swagger UI (try-it-now) →
items_collections__collectionId__items_get - Browse the collection live → /api/collections/adam.adam_eq_events/items
- Queryable properties → /api/collections/adam.adam_eq_events/queryables
Next steps
- Tropical Storms example
- Floods example
- Recurring Date Queries — more filter recipes
- Fetch Event Outputs — drill into dynamic fields