new RoutingRoute()
BeNomad BeMap JavaScript API - RoutingRoute
A single calculated route. A response can contain several when the request
asked for alternatives or used MODE_1_TO_N / N_TO_1 / N_TO_N.
Wire shape from the BeMap server (cross-checked against an actual response
payload):
{
length: long, // total length in metres
duration: long, // total duration in seconds (no traffic)
totalDuration: long, // total duration in seconds (with traffic, if requested)
trafficDelay: long,
departureTime: long, // epoch ms (0 when not set)
arrivalTime: long, // epoch ms (0 when not set)
averageSpeed: double, // km/h
maximumSpeed: double,
startUTurnThreshold: int,
routingInstructions: [...], // turn-by-turn
boundingBox: { minLon, minLat, maxLon, maxLat },
startStopInfo: { start, stop, distanceFirstMatched, distanceLastMatched, interDests },
polyline: [{ lon, lat }, ...] // array of coordinate objects
}
Extras returned by the server but not modelled here are preserved on
`extra` so advanced consumers can still reach them.
For consumer convenience, `getSummary()` returns a synthetic
`bemap.RoutingSummary` built from the route-level totals (distance,
duration, traffic delay, ETA).
- Since:
- 1.5.0
- Source:
Methods
getArrivalTime()
getAverageSpeed()
getDepartureTime()
getDuration()
getInstructions()
getLength()
getMaximumSpeed()
getPolyline() → {Array.<bemap.Coordinate>|null}
Returns the polyline as an Array of `bemap.Coordinate`. The BeMap server
emits the polyline as an array of `{lon, lat}` objects when the POLYLINE
option is requested; we coerce to `bemap.Coordinate` for ergonomics.
Returns `null` when the polyline was not requested.
Returns:
- Type
- Array.<bemap.Coordinate> | null
getPolylineRaw()
getSummary() → {bemap.RoutingSummary}
Synthetic summary object: distance, duration, traffic delay, ETA. Built
from the route-level totals — preserved for parity with consumers that
expect a `summary` object on the route.
Returns:
- Type
- bemap.RoutingSummary