Skip to content

Geoobject-Request

Gibt Geometrien und Haltestellen einer Linie/Linienvariante aus (z. B. für Kartendarstellung).

Endpoint

  • Pfad: XML_GEOOBJECT_REQUEST
  • Methode: GET

Parameter (Auszug)

ParameterTypBeschreibung
lineIdstringLinie inkl. Variante
formatstringKoordinatenformat (z. B. WGS84)
includeStops0/1Haltestellen mitliefern

Beispiel-Request

GET /XML_GEOOBJECT_REQUEST?lineId=VRR:196:A&includeStops=1&format=WGS84

Antwort (Beispiel)

json
{
  "geometry": [[51.45,7.01],[51.46,7.03]],
  "stops": [{ "id": "de:05513:1001", "name": "Essen Hbf" }]
}

JavaScript-Beispiel (Mapbox GL)

js
async function addLineGeometry(map, lineId) {
  const base = 'https://server:port/virtuellesVerzeichnis/XML_GEOOBJECT_REQUEST'
  const usp = new URLSearchParams({ lineId, includeStops: '1', format: 'WGS84' })
  const res = await fetch(`${base}?${usp}`)
  const data = await res.json()
  const coords = data.geometry.map(([lat, lon]) => [lon, lat])
  map.addSource('line', { type: 'geojson', data: { type: 'Feature', geometry: { type: 'LineString', coordinates: coords } } })
  map.addLayer({ id: 'line', type: 'line', source: 'line', paint: { 'line-color': '#0af', 'line-width': 3 } })
}

title: Geoobject-Request (Liniengeometrie & Halte) outline: deep

Geoobject-Request

Liefert die Koordinaten und Haltestellen einer Linie bzw. Linienvariante zur Kartenanzeige.

Endpoint

  • Pfad: XML_GEOOBJECT_REQUEST
  • Methode: GET

Parameter (Auszug)

ParameterTypBeschreibung
lineIdstringLinien-ID/Bezeichnung
directionIdstringRichtung/Kurs
includeStops0/1Haltestellen der Linie mitliefern

Beispiel-Request

GET /XML_GEOOBJECT_REQUEST?lineId=196&directionId=K&includeStops=1

Antwort (Beispiel)

json
{
  "polyline": [ { "lat": 51.4513, "lon": 7.0128 } ],
  "stops": [ { "id": "de:05513:1001", "name": "Essen Hbf" } ]
}

JavaScript-Beispiel

js
async function getLineGeometry(lineId, directionId, includeStops = 1) {
  const base = 'https://server:port/virtuellesVerzeichnis/XML_GEOOBJECT_REQUEST'
  const usp = new URLSearchParams({ lineId, directionId, includeStops: String(includeStops) })
  const res = await fetch(`${base}?${usp}`)
  if (!res.ok) throw new Error('HTTP ' + res.status)
  return res.json()
}