public class

SGREOfflineRoutingService

extends RoutingService
java.lang.Object
   ↳ com.carto.routing.RoutingService
     ↳ com.carto.routing.SGREOfflineRoutingService

Class Overview

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.

Summary

Public Constructors
SGREOfflineRoutingService(Variant geoJSON, Variant config)
Constructs a new SGREOfflineRoutingService instance from a given GeoJSON and rule list.
SGREOfflineRoutingService(Projection projection, FeatureCollection featureCollection, Variant config)
Constructs a new SGREOfflineRoutingService instance from a given feature collection and rule list.
Public Methods
RoutingResult calculateRoute(RoutingRequest request)
Calculates routing result (path) based on routing request.
synchronized void delete()
String getProfile()
Returns the current routing profile.
float getRoutingParameter(String param)
Returns the value of specified routing parameter.
RouteMatchingResult matchRoute(RouteMatchingRequest request)
Matches specified points to the points on the road network.
void setProfile(String profile)
Sets the current routing profile.
void setRoutingParameter(String param, float value)
Sets the value of specified routing parameter.
[Expand]
Inherited Methods
From class com.carto.routing.RoutingService
From class java.lang.Object

Public Constructors

public SGREOfflineRoutingService (Variant geoJSON, Variant config)

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

public SGREOfflineRoutingService (Projection projection, FeatureCollection featureCollection, Variant config)

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

Public Methods

public RoutingResult calculateRoute (RoutingRequest request)

Calculates routing result (path) based on routing request.

Parameters
request The routing request defining via points.
Returns
  • The result or null if routing failed.
Throws
IOException

public synchronized void delete ()

public String getProfile ()

Returns the current routing profile.

Returns
  • The current routing profile.

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.

public RouteMatchingResult matchRoute (RouteMatchingRequest request)

Matches specified points to the points on the road network.

Parameters
request The matching request defining points.
Returns
  • The matching result or null if route matching failed.
Throws
IOException

public void setProfile (String profile)

Sets the current routing profile.

Parameters
profile The new routing profile. Routing profiles are dependent on specific routing service.

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.