Pendelzeit-API

Erreichbare Flächen auf Karten

POST /v1/isochrones liefert die Gegend, die ab einem Start mit einem Verkehrsmittel in bis zu drei Zeitstufen erreichbar ist – zum Beispiel „bis 30 / 60 / 90 Minuten mit dem ÖPNV“ als Flächen auf einer Stellenkarte. Die Antwort ist GeoJSON und lässt sich in Leaflet, MapLibre oder OpenLayers direkt als Ebene zeichnen.

Der Endpunkt ist nur mit geheimem Key nutzbar (Aufruf von Ihrem Server). Die Berechnung ist deutlich aufwendiger als einzelne Reisezeiten; öffentliche Keys erhalten 403.

Anfrage

Shell
curl -sS --fail-with-body 'https://api.pendelzeit.de/v1/isochrones' \
  -H 'Authorization: Bearer pz_sk_IHR_GEHEIMER_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "origin": { "lat": 51.36114, "lon": 12.36001 },
    "mode": "transit",
    "minutes": [30, 60, 90]
  }' -o /dev/null -w '%{http_code}'
Feld Pflicht Bedeutung
origin ja Start (WGS 84); die API rundet ihn auf ca. 100 m
mode ja car, transit, bike, ebike, walk
minutes nein 1–3 aufsteigende Stufen, je 5–90 Minuten; Standard [30, 60, 90]
arrivalWindow nein nur ÖPNV, Standard werktags 07:30–08:30 Uhr wie bei Reisezeiten

Antwort

Eine FeatureCollection mit einem MultiPolygon je Stufe, größte Stufe zuerst (application/geo+json):

JSON
{
  "type": "FeatureCollection",
  "features": [
    { "type": "Feature", "properties": { "minutes": 90, "mode": "transit" }, "geometry": { "type": "MultiPolygon", "coordinates": [ "…" ] } },
    { "type": "Feature", "properties": { "minutes": 60, "mode": "transit" }, "geometry": { "type": "MultiPolygon", "coordinates": [ "…" ] } },
    { "type": "Feature", "properties": { "minutes": 30, "mode": "transit" }, "geometry": { "type": "MultiPolygon", "coordinates": [ "…" ] } }
  ],
  "origin": { "lat": 51.361, "lon": 12.36 },
  "computedAt": "2026-10-20T07:12:00+02:00",
  "resolutionMeters": 200,
  "arrivalWindow": { "from": "07:30", "to": "08:30", "date": "2026-10-27" },
  "attribution": [
    { "text": "© OpenStreetMap-Mitwirkende, ODbL", "url": "https://www.openstreetmap.org/copyright" },
    { "text": "Fahrplandaten DELFI e. V., CC BY 4.0", "url": "https://www.delfi.de" }
  ]
}

Auf der Karte (Leaflet)

Ihr Server ruft die API auf und reicht das GeoJSON an die Seite weiter (Key bleibt auf dem Server):

JavaScript
const data = await fetch('/ihr-server/erreichbarkeit?lat=51.36114&lon=12.36001&mode=transit').then((r) => r.json());
const shades = { 90: '#c8e6c9', 60: '#66bb6a', 30: '#1b5e20' };
L.geoJSON(data, {
  style: (feature) => ({ color: shades[feature.properties.minutes], weight: 1, fillOpacity: 0.35 }),
}).addTo(map);
map.attributionControl.addAttribution(data.attribution.map((a) => a.text).join(' · '));

Zwischenspeicher, Limits, Ausfall