Class GLRouteRequest

java.lang.Object
globus.glroute.GLRouteRequest

@ParametersAreNonnullByDefault
public class GLRouteRequest
extends java.lang.Object
GLMapRouteData used request online or offline route.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  GLRouteRequest.ResultsCallback
    Callback that will be called when request is finished
  • Field Summary

    Fields
    Modifier and Type Field Description
    float avoidBadSurfaces
    This value is meant to represent how much a cyclist wants to avoid roads with poor surfaces relative to the bicycle type being used.
    int bikeType
    The type of bicycle.
    java.lang.String locale
    Locale for instructions.
    int mode
    Mode of the route.
    boolean optimize
    If `true`, then order of middle points can be changed to make route faster.
    float stepPenalty
    A penalty in seconds added to each transition onto a path with steps or stairs.
    int unitSystem
    Unit system for instructions.
    float useFerry
    This value indicates the willingness to take ferries.
    float useHighways
    This value indicates the willingness to take highways.
    float useHills
    A cyclist's desire to tackle hills in their routes.
    float useRoads
    A cyclist's propensity to use roads alongside other vehicles.
    float useTolls
    This value indicates the willingness to take roads with tolls.
  • Constructor Summary

    Constructors
    Constructor Description
    GLRouteRequest()
    Default constructor
    GLRouteRequest​(java.lang.String userJSON)
    Constructor with custom json request to valhalla
  • Method Summary

    Modifier and Type Method Description
    void addPoint​(GLRoutePoint point)
    Adds point
    static void cancel​(long requestID)
    Cancels request that was started
    void setOfflineWithConfig​(java.lang.String config)
    Makes request offline
    long start​(GLRouteRequest.ResultsCallback callback)
    Start request

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • optimize

      public boolean optimize
      If `true`, then order of middle points can be changed to make route faster. By default is false.
    • mode

      public int mode
      Mode of the route. By default `GLRoute.Mode.DRIVE`
    • unitSystem

      public int unitSystem
      Unit system for instructions. By default `GLUnitSystem.International`
    • locale

      public java.lang.String locale
      Locale for instructions. By default equals to `Locale.getDefault().getLanguage()`
    • useFerry

      public float useFerry
      This value indicates the willingness to take ferries. This is a range of values between 0 and 1. Values near 0 attempt to avoid ferries and values near 1 will favor ferries. Note that sometimes ferries are required to complete a route so values of 0 are not guaranteed to avoid ferries entirely. The default value is 0.5.
    • useHighways

      public float useHighways
      This value indicates the willingness to take highways. This is a range of values between 0 and 1. Values near 0 attempt to avoid highways and values near 1 will favor highways. The default value is 1.0. Note that sometimes highways are required to complete a route so values of 0 are not guaranteed to avoid highways entirely.
    • useTolls

      public float useTolls
      This value indicates the willingness to take roads with tolls. This is a range of values between 0 and 1. Values near 0 attempt to avoid tolls and values near 1 will not attempt to avoid them. The default value is 0.5. Note that sometimes roads with tolls are required to complete a route so values of 0 are not guaranteed to avoid them entirely.
    • bikeType

      public int bikeType
      The type of bicycle. The default type is `GLRoute.BikeType.HYBRID`. Road: a road-style bicycle with narrow tires that is generally lightweight and designed for speed on paved surfaces. Hybrid or City: a bicycle made mostly for city riding or casual riding on roads and paths with good surfaces. Cross: a cyclo-cross bicycle, which is similar to a road bicycle but with wider tires suitable to rougher surfaces. Mountain: a mountain bicycle suitable for most surfaces but generally heavier and slower on paved surfaces.
    • useRoads

      public float useRoads
      A cyclist's propensity to use roads alongside other vehicles. This is a range of values from 0 to 1, where 0 attempts to avoid roads and stay on cycleways and paths, and 1 indicates the rider is more comfortable riding on roads. Based on the use_roads factor, roads with certain classifications and higher speeds are penalized in an attempt to avoid them when finding the best path. The default value is 0.5.
    • useHills

      public float useHills
      A cyclist's desire to tackle hills in their routes. This is a range of values from 0 to 1, where 0 attempts to avoid hills and steep grades even if it means a longer (time and distance) path, while 1 indicates the rider does not fear hills and steeper grades. Based on the use_hills factor, penalties are applied to roads based on elevation change and grade. These penalties help the path avoid hilly roads in favor of flatter roads or less steep grades where available. Note that it is not always possible to find alternate paths to avoid hills (for example when route locations are in mountainous areas). The default value is 0.5.
    • avoidBadSurfaces

      public float avoidBadSurfaces
      This value is meant to represent how much a cyclist wants to avoid roads with poor surfaces relative to the bicycle type being used. This is a range of values between 0 and 1. When the value is 0, there is no penalization of roads with different surface types; only bicycle speed on each surface is taken into account. As the value approaches 1, roads with poor surfaces for the bike are penalized heavier so that they are only taken if they significantly improve travel time. When the value is equal to 1, all bad surfaces are completely disallowed from routing, including start and end points. The default value is 0.25.
    • stepPenalty

      public float stepPenalty
      A penalty in seconds added to each transition onto a path with steps or stairs. Higher values apply larger cost penalties to avoid paths that contain flights of steps.
  • Constructor Details

    • GLRouteRequest

      public GLRouteRequest()
      Default constructor
    • GLRouteRequest

      public GLRouteRequest​(java.lang.String userJSON)
      Constructor with custom json request to valhalla
      Parameters:
      userJSON - json request to valhalla
  • Method Details

    • addPoint

      public void addPoint​(GLRoutePoint point)
      Adds point
      Parameters:
      point - point to add
    • setOfflineWithConfig

      public void setOfflineWithConfig​(java.lang.String config)
      Makes request offline
      Parameters:
      config - Contents of configuration file for routing engine Valhalla. See valhalla.json inside the demoApp.
    • start

      public long start​(GLRouteRequest.ResultsCallback callback)
      Start request
      Parameters:
      callback - results callback
      Returns:
      id of task
    • cancel

      public static void cancel​(long requestID)
      Cancels request that was started
      Parameters:
      requestID - ID of request to cancel