Avatar

Routes - Example

0

I went through the SDK and all the sample code but did not come across an example for creating a route. 
I have ten addresses that I want to create a route from. What is the easiest way to create and send this to a Garmin GPS. Thanks in advance

Mauricio Muniz

Please sign in to leave a comment.

1 comment

0
Avatar

Hi there, 

Here's some info on Routes: 

Creating a Route with the SDK 

A basic Route object contains a RroutePlanItemCollection. Each of these objects defines the sequence number and zone (stop). You can reverse geocode the address to reveal a GPS location, then create a zone around this location. This zone would be a property of a RoutPlan item in the collection. (you could also search for a zone at this location and use the zone found or create a new one if not found) 

Sending route stops to a device 

You would send TextMessage to a device with each stop being the content (RouteMessage) of that TextMessage. These would be added in the sequence of the stops. Each RouteMessage would contain the address and coordinates. 

Note: See an example of clearing previous stops here: 
http://www.geotab.com/support/forum...fault.aspx 

Here is Javascript code from the importRoute.html sample:

List<RoutePlanItem> routePlanItems = new List<RoutePlanItem>();
for (int i = 0; i < zones.Count; i++)
{
    routePlanItems.Add(new RoutePlanItem(
        null, 
        new Zone { EntityIdentifier = zones[i].EntityIdentifier }, 
        null, 
        i, 
        DateTime.MinValue, 
        DateTime.MaxValue));
}

Route route = new Route(null, "My Route", "Comment", routePlanItems);

api.Call<Route>("Add", typeof (Route), new {entity = route});
Geotab Developers 0 votes