GET /v1/terrain/profile

Höhenprofil entlang einer Polyline

stable seit v0.1.0 terrain auth: api_key · ab hobby

GET /v1/terrain/profile — Höhenprofil entlang einer Linie

Sampelt die Geländehöhe (DHHN2016) an N gleichverteilten Punkten entlang einer WGS84-Polyline. Liefert GeoJSON-FeatureCollection mit kumulierten Distanzen + Pro-Tile-Quellen-Tracking.

Zugang

Ab Tarif Hobby, mit API-Key im Header X-API-Key. Ohne Key antwortet der Endpoint mit 401, mit einem Key unter Hobby mit 403 (beides application/problem+json, mit Link auf Key bzw. Tarife). Einen Testkey bekommst du in einer Minute unter lodapi.de/key: 7 Tage gültig, Pro-Umfang, ohne Registrierung. Die Beispiele unten lesen den Key aus der Umgebungsvariable LODAPI_KEY.

Wann verwenden

  • Wanderwege / Mountainbike-Strecken-Tools (Höhenprofil-Chart).
  • Lineare Infrastruktur-Planung (Glasfaser, Leitungen, Bahn).
  • Sichtachsen-Analyse über Gelände.

Für eine einzelne Punktabfrage ist /v1/terrain/elevation schneller — /profile öffnet pro betroffenem Tile eine separate COG-Sample-Operation (Batch-optimiert).

Examples

curl — 500 Punkte über 10 km

curl -s -H "X-API-Key: $LODAPI_KEY" \
  'https://api.lodapi.de/v1/terrain/profile?coords=13.37,52.51;13.45,52.55&samples=500' \
  | jq '.properties, .features[0]'

Python — Chart-Datenpunkte

# pip install lodapi
import os

from lodapi import Client

with Client(api_key=os.environ["LODAPI_KEY"]) as c:
    data = c.terrain.profile(
        coords=[(13.37, 52.51), (13.40, 52.53), (13.45, 52.55)],  # (lon, lat)
        samples=200,
    )
chart = [
    (f["properties"]["distance_m"], f["properties"]["elevation_m"])
    for f in data.features
    if f["properties"]["elevation_m"] is not None
]
print(f"Total length: {data.properties.total_length_m:.0f} m, {len(chart)} valid samples")

Parameters

ParameterInTypeRequiredDefaultRangeBeschreibung
coordsquerystringyes—≥ 2 Punktelon1,lat1;lon2,lat2[;...] WGS84 Grad
samplesqueryintno1002..2000Anzahl Sample-Punkte

Response

200 OK · application/json — GeoJSON-FeatureCollection (RFC 7946) mit Lodapi-Erweiterungen in properties.

{
  "type": "FeatureCollection",
  "properties": {
    "datum": "DHHN2016",
    "coords_count": 3,
    "samples": 200,
    "total_length_m": 9543.7,
    "partial": false,
    "failed_tile_ids": []
  },
  "features": [
    {
      "type": "Feature",
      "geometry": { "type": "Point", "coordinates": [13.37, 52.51] },
      "properties": {
        "elevation_m": 38.4,
        "distance_m": 0.0,
        "source_bl": "be",
        "tile_id": "be_33_387_5821"
      }
    }
  ]
}

Partial-Modus

properties.partial: true zeigt an, dass mindestens ein Sample außerhalb der Coverage liegt oder bei der COG-Sample-Operation gescheitert ist:

  • Diese Features haben elevation_m: null, tile_id: null.
  • properties.failed_tile_ids[] listet Tile-IDs, deren Read failed ist (Behörden-Server kurz down, NoData-Cluster).
  • Die anderen Features sind weiter valide — die Antwort ist 200, nicht 502.

Fehler

StatusBedingung
401Kein X-API-Key mitgeschickt (oder Key unbekannt/abgelaufen)
403Key-Tarif unter Hobby
400coords malformed oder < 2 Punkte
404Alle Samples außerhalb Coverage
422samples out of range
502DB unerreichbar

Stolperdrähte

  • Linien-Länge wird in UTM32N gemessen (auch wenn die Polyline durch UTM33N-Gebiet geht) — minimaler Längenfehler an Region-Grenzen, unter 0,1 %.
  • samples skaliert linear mit Antwortgröße — 2000 Samples × ~150 Bytes/Feature ≈ 300 KB.
  • Pro-Tile-Batching macht große Profile sehr schnell, weil ein COG einmal geöffnet wird und alle seine Sample-Punkte zusammen abruft.

Verwandte Endpoints

Verwandt

  • /v1/terrain/elevation
  • /v1/terrain/datasets

Bereit?

Der erste Call geht sofort.

LoD2-Gebäude für alle 16 Bundesländer, kostenlos und ohne Konto. Pro auf Anfrage 30 Tage testen.