Class Route

java.lang.Object
com.here.NativeBase
com.here.sdk.routing.Route

public final class Route extends NativeBase

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 Details

    • serialize

      @Nullable public static byte[] serialize(@NonNull Route route)

      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

      @Nullable public static Route deserialize(@NonNull byte[] routeData)

      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

      @NonNull public List<Section> getSections()

      Gets the sections that make up this route.

      Returns:

      The sections that make up this route.

    • getGeometry

      @NonNull public GeoPolyline getGeometry()

      Gets the GeoPolyline object representing the polyline of this route. It may not contain the original coordinates specified in the request for a route.

      Returns:

      The GeoPolyline object representing the polyline of this route. It may not contain the original coordinates specified in the request for a route.

    • getBoundingBox

      @NonNull public GeoBox 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

      @NonNull public LanguageCode 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

      @NonNull public OptimizationMode getOptimizationMode()

      Gets the optimization mode requested for route calculation.

      Returns:

      The optimization mode requested for route calculation.

    • getRequestedTransportMode

      @NonNull public TransportMode getRequestedTransportMode()

      Gets the transport mode requested for route calculation.

      Returns:

      The transport mode requested for route calculation.

    • getConsumptionInKilowattHours

      @Nullable public Double 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

      @Nullable public RouteHandle getRouteHandle()

      Gets the route handle of this route. Note that it is provided only if RouteOptions.enableRouteHandle is set before route calculation.

      Returns:

      The route handle of this route. Note that it is provided only if RouteOptions.enableRouteHandle is set before route calculation.

    • getDuration

      @NonNull public Duration 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

      @NonNull public Duration 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

      @Nullable public RoutingOptions getRoutingOptions()

      Gets the options used to calculate this route.

      Returns:

      The set of options used to calculate the route.

    • getRailwayCrossings

      @NonNull public List<RouteRailwayCrossing> 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

      @NonNull public List<RouteLabel> 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 RouteLabel instances for the route. It will return an empty list if no labels are available.