Class SGREOfflineRoutingService

java.lang.Object
com.massifmaps.routing.RoutingService
com.massifmaps.routing.SGREOfflineRoutingService

public class SGREOfflineRoutingService extends RoutingService
An offline routing service that uses SGRE routing engine.
Note: this class is experimental and may change or even be removed in future SDK versions.
  • Constructor Details

    • SGREOfflineRoutingService

      public SGREOfflineRoutingService(Variant geoJSON, Variant config) throws IOException
      Constructs a new SGREOfflineRoutingService instance from a given GeoJSON and rule list.
      Parameters:
      geoJSON - The GeoJSON variant specifying features used for the routing graph.
      config - A configuration specifying various routing metrics and rules.
      Throws:
      Exception - If an error occured during rule list parsing.
      IOException
    • SGREOfflineRoutingService

      public SGREOfflineRoutingService(Projection projection, FeatureCollection featureCollection, Variant config) throws IOException
      Constructs a new SGREOfflineRoutingService instance from a given feature collection and rule list.
      Parameters:
      projection - Projection for the features in featureCollection. Can be null if the coordinates are based on WGS84.
      featureCollection - The feature collection used for the routing graph.
      config - A configuration specifying various routing metrics and rules.
      Throws:
      Exception - If an error occured during rule list parsing.
      IOException
  • Method Details

    • getRoutingParameter

      public float getRoutingParameter(String param)
      Returns the value of specified routing parameter.
      Parameters:
      param - The name of the parameter. For example "$speed".
      Returns:
      The value of the parameter. If the parameter does not exist, NaN is returned.
    • setRoutingParameter

      public void setRoutingParameter(String param, float value)
      Sets the value of specified routing parameter.
      Parameters:
      param - The name of the parameter. For example "$speed".
      value - The new value of the parameter.
    • getProfile

      public String getProfile()
      Description copied from class: RoutingService
      Returns the current routing profile.
      Overrides:
      getProfile in class RoutingService
      Returns:
      The current routing profile.
    • setProfile

      public void setProfile(String profile)
      Description copied from class: RoutingService
      Sets the current routing profile.
      Overrides:
      setProfile in class RoutingService
      Parameters:
      profile - The new routing profile. Routing profiles are dependent on specific routing service.
    • matchRoute

      public RouteMatchingResult matchRoute(RouteMatchingRequest request) throws IOException
      Description copied from class: RoutingService
      Matches specified points to the points on the road network.
      Overrides:
      matchRoute in class RoutingService
      Parameters:
      request - The matching request defining points.
      Returns:
      The matching result or null if route matching failed.
      Throws:
      IOException
    • calculateRoute

      public RoutingResult calculateRoute(RoutingRequest request) throws IOException
      Description copied from class: RoutingService
      Calculates routing result (path) based on routing request.
      Overrides:
      calculateRoute in class RoutingService
      Parameters:
      request - The routing request defining via points.
      Returns:
      The result or null if routing failed.
      Throws:
      IOException