Application Programming Interface (API)


API-Attribute 'GPXRequest'

Der API-Aufruf 'GPXRequest' verarbeitet eine hochgeladene GPX-Datei. Für jeden Punkt innerhalb der GPX-Datei werden die entsprechenden Höheninformationen abgefragt und in die Datei integriert. Die Antwort enthält die aktualisierte GPX-Datei (Base64-kodiert) sowie Statistiken zur Anzahl der Punkte und den verwendeten Datenquellen mit deren Attributionen.

Attribut Subattribut Datentyp Beschreibung
Type string Typ der Anfrage (GPXRequest)
ID string ID der Anfrage
Attributes struct Attribute der Anfrage
GPXData string GPX-Datei (Base64-Kodierung)

API-Attribute 'GPXResponse'

Attribut Subattribut Subattribut Datentyp Beschreibung
Type string Typ der Antwort (GPXResponse)
ID string ID der Antwort
Attributes struct Attribute der Antwort
GPXData string GPX-Datei (Base64-Kodierung)
GPXPoints int Anzahl Punkte in der GPX-Datei
DGMPoints int Anzahl Punkte mit DGM-Höhendaten
Attributions []string Attributionen der Daten
IsError bool Fehler (ja/nein)
Error struct Fehlerdetails
Code string Fehlernummer
Title string Fehlerbeschreibung
Details string Fehlerdetaillierung

GPXRequest (Beispiel)


#!/bin/bash
#
# Abfrage der Höhendaten für alle Punkte einer GPX-Datei

gpxdata=$(cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1">
  <wpt lat="51.276389" lon="8.558333">
    <name>Langenberg (Rothaargebirge, höchster Berg in NRW)</name>
  </wpt>
  <wpt lat="51.179444" lon="8.488889">
    <name>Kahler Asten (Rothaargebirge, zweithöchster Berg in NRW)</name>
  </wpt>
</gpx>
EOF
)
gpxdataBase64=$(base64 -w 0 <<< "$gpxdata")

postdata=$(cat <<EOF
{
  "Type": "GPXRequest",
  "ID": "rothaargebirge.gpx",
  "Attributes": {
      "GPXData": "$gpxdataBase64"
  }
}
EOF
)

echo "postdata =\n$postdata"

curl \
--silent \
--include \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "$postdata" \
https://api.hoehendaten.de:14444/v1/gpx


GPXResponse ('GPXData' gekürzt)


HTTP/2 200
access-control-allow-headers: Content-Type
access-control-allow-methods: POST
access-control-allow-origin: *
content-type: application/json; charset=utf-8
content-length: 1531
date: Tue, 22 Apr 2025 08:08:23 GMT

{
  "Type": "GPXResponse",
  "ID": "rothaargebirge.gpx",
  "Attributes": {
    "GPXData": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iV...yMDIxLTAzPC9kZXNjPgoJPC93cHQ+CjwvZ3B4Pg==",
    "GPXPoints": 2,
    "DGMPoints": 2,
    "Attributions": [
      "DE-NW: © GeoBasis-DE / NRW (2025), dl-zero-de/2.0, www.geobasis.nrw.de"
    ],
    "IsError": false,
    "Error": {
      "Code": "",
      "Title": "",
      "Detail": ""
    }
  }
}
        

Erzeugte GPX-Datei


<?xml version="1.0" encoding="UTF-8"?>
<gpx  xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="https://github.com/tkrajina/gpxgo">
    <metadata>
        <desc>Die Höhenangaben (ele) basieren auf DGM-Daten mit hoher Genauigkeit.</desc>
        <author></author>
        <copyright author="DE-NW: © GeoBasis-DE / NRW (2025), dl-zero-de/2.0, www.geobasis.nrw.de"></copyright>
    </metadata>
    <wpt lat="51.276389" lon="8.558333">
        <ele>843.07</ele>
        <name>Langenberg (Rothaargebirge, höchster Berg in NRW)</name>
        <desc>ele: DE-NW, 2021-03</desc>
    </wpt>
    <wpt lat="51.179444" lon="8.488889">
        <ele>839.83</ele>
        <name>Kahler Asten (Rothaargebirge, zweithöchster Berg in NRW)</name>
        <desc>ele: DE-NW, 2021-03</desc>
    </wpt>
</gpx>