Skip to main content

TransitLeg

modestring

"WALK" | "BUS" | other OTP2 transit modes.

Example: BUS
start_timeinteger

Unix seconds this leg starts.

end_timeinteger

Unix seconds this leg ends.

duration_snumber<double>
distance_mnumber<double>
from_namestring

Boarding stop (or origin for walk legs).

Example: Ritz
from_latnumber<double>
from_lngnumber<double>
to_namestring
Example: Achimota Hospital
to_latnumber<double>
to_lngnumber<double>
route_short_namestring
Example: 081B
route_long_namestring
Example: Adenta Station to Achimota Station
headsignstring
geometrynumber[][]

Decoded leg path as [lng, lat] pairs (OTP2 legGeometry, 5-digit precision polyline). Present on walk and ride legs; absent when the source gave none (clients may fall back to a straight line between from/to).

Possible values: >= 2, <= 2

stops object[]

Intermediate stops along a transit ride (walk legs have none).

  • Array [
  • namestring
    Example: St Mary
    latnumber<double>
    lngnumber<double>
  • ]
  • TransitLeg
    {
    "mode": "BUS",
    "start_time": 0,
    "end_time": 0,
    "duration_s": 0,
    "distance_m": 0,
    "from_name": "Ritz",
    "from_lat": 0,
    "from_lng": 0,
    "to_name": "Achimota Hospital",
    "to_lat": 0,
    "to_lng": 0,
    "route_short_name": "081B",
    "route_long_name": "Adenta Station to Achimota Station",
    "headsign": "string",
    "geometry": [
    0
    ],
    "stops": [
    {
    "name": "St Mary",
    "lat": 0,
    "lng": 0
    }
    ]
    }