The routing plugin allows you to generate safe and legal routes for commercial vehicles and display those routes on the map. To use the plugin:
To add the dependency, configure your Cartfile as follows:
# Latest stable release binary "https://trimblemaps.jfrog.io/artifactory/carthage/RoutePlugin.json" == 0.1.6 binary "https://trimblemaps.jfrog.io/artifactory/carthage/TrimbleMapsWebservicesClient.json" == 0.1.4 binary "https://trimblemaps.jfrog.io/artifactory/carthage/Turf.json" == 0.1.0 github "raphaelmor/Polyline" ~> 5.0
When initializing the RoutePlugin, you pass it the TMGLMapView that the plugin will draw routes on.
routePlugin = RoutePlugin(mapView: mapView)
How to generate a route
In order to use the route plugin, you must first create a route to pass in. To generate a route, you need to define and initiate the
RouteOptions with a list of all stops in the trip.
let options = RouteOptions(waypoints: [startPoint, stopPoint, endPoint]) let route = Route() route.routeOptions = options
Once we have a valid route, we can pass that route into the RoutePlugin and it will draw the route on the map.