Route (API Reference)
Class Route
A route is a path through a road network over which someone travels.
Note: Each Section of a route contains a list of SectionNotice objects
that describe potential issues after the route was calculated. If the list is non-empty,
it is recommended to evaluate possible violations against the requested route options and
reject the route if deemed necessary.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Routedeserialize(byte[] routeData) Creates route from the given binary data.Gets the closest rectangular area where this route fits in.Gets estimated net energy consumption (in kWh) if the transportation mode used for this route is an electric vehicle.Gets the estimated time in seconds needed to travel along this route, including real-time traffic delays if available.Gets theGeoPolylineobject representing the polyline of this route.Gets the language requested for all textual information related to this route.intGets the length of this route in meters.Gets the optimization mode requested for route calculation.Gets railway crossings.Gets the transport mode requested for route calculation.Gets the route handle of this route.Gets route labels.Gets the options used to calculate this route.Gets the sections that make up this route.Gets the estimated time in seconds spent in traffic along this route.static byte[]Serializes given route to a binary data.
-
Method Details
-
serialize
Serializes given route to a binary data. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
- Parameters:
route-The route which should be serialized.
- Returns:
The binary data of the route.
-
deserialize
Creates route from the given binary data. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
- Parameters:
routeData-The binary of a serialized route.
- Returns:
The route object restored from the binary data.
-
getSections
Gets the sections that make up this route.
- Returns:
The sections that make up this route.
-
getGeometry
Gets the
GeoPolylineobject representing the polyline of this route. It may not contain the original coordinates specified in the request for a route.- Returns:
The
GeoPolylineobject representing the polyline of this route. It may not contain the original coordinates specified in the request for a route.
-
getBoundingBox
Gets the closest rectangular area where this route fits in.
- Returns:
The closest rectangular area where this route fits in.
-
getLengthInMeters
public int getLengthInMeters()Gets the length of this route in meters.
- Returns:
The length of this route in meters.
-
getLanguage
Gets the language requested for all textual information related to this route.
- Returns:
Indicates the language requested for all textual information related to this route.
-
getOptimizationMode
Gets the optimization mode requested for route calculation.
- Returns:
The optimization mode requested for route calculation.
-
getRequestedTransportMode
Gets the transport mode requested for route calculation.
- Returns:
The transport mode requested for route calculation.
-
getConsumptionInKilowattHours
Gets estimated net energy consumption (in kWh) if the transportation mode used for this route is an electric vehicle. Note that it can be negative due to energy recuperation.
- Returns:
Estimated net energy consumption (in kWh) if the transportation mode used for this route is an electric vehicle. Note that it can be negative due to energy recuperation.
-
getRouteHandle
Gets the route handle of this route. Note that it is provided only if
RouteOptions.enableRouteHandleis set before route calculation.- Returns:
The route handle of this route. Note that it is provided only if
RouteOptions.enableRouteHandleis set before route calculation.
-
getDuration
Gets the estimated time in seconds needed to travel along this route, including real-time traffic delays if available.
- Returns:
The estimated time in seconds needed to travel along this route, including real-time traffic delays if available.
-
getTrafficDelay
Gets the estimated time in seconds spent in traffic along this route. Negative values indicate that the route can be traversed faster than usual.
- Returns:
The estimated time in seconds spent in traffic along this route. Negative values indicate that the route can be traversed faster than usual.
-
getRoutingOptions
Gets the options used to calculate this route.
- Returns:
The set of options used to calculate the route.
-
getRailwayCrossings
Gets railway crossings.
Railway crossing information is only available for routes created with the online
RoutingEngine.- Returns:
Collection of railway crossings along the route.
-
getRouteLabels
Gets route labels.
The main street names or route numbers through which the route is going to pass that differentiate it from other alternatives routes. The labels are ordered by importance based on how much time the route spends on each road segment, not by traversal sequence. This helps users quickly identify and distinguish between different route alternatives when alternative routes have been quested via
RouteOptions.- Returns:
A collection containing a maximum of 2
RouteLabelinstances for the route. It will return an empty list if no labels are available.
-