Skip to content

Infrastructure search

GET /v1/places finds stations, halts and RINF operational points. Everything else with a name — the yard a train is formed in, a siding, a depot, a tunnel, a level crossing, the border point of a cross-border line — is found with GET /v1/infra/search. It needs an API key with the route scope.

Terminal window
curl -H "Authorization: Bearer $RAIL_API_KEY" \
"https://api.routing.gleisklar.de/v1/infra/search?q=maschen&types=yard"
{
"results": [
{
"id": "way/4711",
"category": "yard",
"object_type": "yard",
"name": "Rangierbahnhof Maschen",
"lat": 53.396, "lon": 10.041,
"source": "osm",
"score": 9089,
"object_ids": ["way/4711", "node/4712"]
}
],
"next_cursor": null
}

Every result names an infrastructure object: fetch its attributes, geometry and sources with GET /v1/infra/objects/{id} (write the / as :, e.g. /v1/infra/objects/way:4711). category is the search category, object_type the object’s type in /v1/infra/objects (a siding is a track). When one thing is mapped as several objects — a tunnel as several track ways, a yard as a node and an area — they come as one result listing every part in object_ids, the first being id.

typesWhatSource
sidingSidings, spurs, industrial tracks with a name or numberOSM track with service=siding/spur/yard or usage=industrial and name or ref; RINF private sidings where reported
yardMarshalling and storage yardsOSM railway=yard; RINF shunting yards where reported
freight_terminalFreight and intermodal terminalsOSM railway=freight_terminal, industrial=intermodal_freight_terminal; RINF freight terminals where reported
depotDepots and workshopsOSM railway=depot, railway=service_station, railway=workshop; RINF depots or workshops where reported
border_pointBorder pointsOSM railway=border; RINF operational points of type border point
level_crossingLevel crossings by name or numberOSM railway=level_crossing/crossing with name or ref
tunnel, bridgeNamed tunnels and bridgesOSM tunnel:name / bridge:name of the track

Without types all of them are searched. German RINF types its operational points only as station, passenger stop, junction, border point, technical change or switch, so in Germany the RINF part is the border points; other countries’ RINF data also has the others.

source says where a result comes from: osm, rinf (a RINF operational point without an OSM station: rinf-op/<UOPID>), or osm+rinf (a RINF operational point that is part of an OSM station: the station’s node/…).

  • q: a name or reference. Matching works as in place search: case, umlauts (Muenchen, Munchen) and abbreviations (Rbf, Bf, Hbf) don’t matter, word starts match (maschen finds “Rangierbahnhof Maschen”), a reference written in capitals ranks first (BÜ 12, A7), and typos are tolerated when nothing else matches.

  • bbox: minLon,minLat,maxLon,maxLat, only objects inside. Without q the bbox is required and every object of the types in it is listed (at most 0.25 deg², about 33 × 55 km in Germany) — the way to find unnamed border points:

    Terminal window
    curl -H "Authorization: Bearer $RAIL_API_KEY" \
    "https://api.routing.gleisklar.de/v1/infra/search?types=border_point&bbox=9.2,54.75,9.5,54.85"
  • limit: 1–50, default 10; further pages with cursor (the previous page’s next_cursor).

EndpointWhat
GET /v1/infra/objects?bbox=Every object touching the box (at most 0.25 deg²) as a GeoJSON FeatureCollection, in ID order; types filters (track includes tunnels and bridges). limit default 500, at most 2,000; next_cursor for the next page
GET /v1/infra/objects/{id}One object (way:<osm id>, node:<osm id>, rinf-op:<UOPID>)
GET /v1/infra/lines/{line}A line’s infrastructure as km sections of equal speed, electrification, track class and load, gauging, ETCS and class B protection, structures, RINF section and number of parallel tracks, with geometry and km jumps; the whole line or from_km–to_km
POST /v1/infra/along-routeA route as POST /v1/route finds it, described by its infrastructure: sections with km along the route, the lines in travel order, and the objects on its track nodes (signals, switches, level crossings, border points; types filters) with their km

Object types are track, tunnel, bridge, station, operational_point, platform, signal, switch, level_crossing, yard, freight_terminal, depot and border_point. Each object’s properties keep the sources apart: osm (the OSM tags), rinf (the RINF attributes) and derived (values computed from both, each with its *_source). A RINF operational point that is part of an OSM station is found under the station; asking for it by its rinf-op/… ID answers 404 with the station’s ID in the detail.

import { createClient, paginate } from "@quebi/rail-api"
const api = createClient({ apiKey: process.env.RAIL_API_KEY })
const { results } = await api.infraSearch({ q: "maschen", types: "yard,depot" })
const yard = await api.infraObject(results[0].id) // way/… is accepted as is
for await (const page of paginate((cursor) => api.infraObjects({ bbox: "9.9,53.5,10.1,53.6", types: "signal", cursor }))) {
for (const signal of page.features) console.log(signal.id, signal.properties.derived.signal_kind)
}

The playground’s search tab has a second mode, yards, sidings, crossings …, with a chip per type. show moves the map to the object and opens it in the inspect tab; with an empty search text and the map zoomed in, it lists the objects in view.