Route Services

Route Path

Given a list of stop coordinates and route options, the route path service will return a list of coordinates that make up the route. The service can be consumed using the getRoutePath function, on the ALKMaps.Services class. The parameters are layed out in the table below.

Parameter Type Description
stops StringArray A list of the route stop's coordinates in the format of 'longitude,latitude;longitude,latitude;longitude,latitude'
options Object See routing layer page for a list of available options.
var stops =  [new ALKMaps.LonLat(-75.339368,40.11442),new ALKMaps.LonLat(-74.911539,40.159933),new ALKMaps.LonLat(-74.885531,39.993483),new ALKMaps.LonLat(-75.191123,39.802326)];

ALKMaps.Services.getRoutePath({
    stops: stops,
    options: {
        'vehicleType': 'Truck', 
        'routingType': 'Practical', 
        'routeOptimization': 1, 
        'highwayOnly': false, 
        'distanceUnits': 'Miles', 
        'tollDiscourage': true
    } 
});
                

The function returns a MultLineString feature.

Derived Route Path

Given a list of ping coordinates and route options, the derived route path service will return a list of derived route points. This service can be consumed using the getDerivedRoutePath function of the ALKMaps.Services class. The parameters are essentially the exact same as the getRoutePath function, aside from the fact that the parameter for the input coordinates is called pings instead of stops.

var pings =  [new ALKMaps.LonLat(-75.339368,40.11442),new ALKMaps.LonLat(-74.911539,40.159933),new ALKMaps.LonLat(-74.885531,39.993483)];

map.getDerivedRoutePath({
    pings: [[pings[0].lon,pings[0].lat],[pings[1].lon,pings[1].lat],[pings[2].lon,pings[2].lat]],
    options: {
        'vehicleType': 'Truck', 
        'routingType': 'Practical', 
        'routeOptimization': 1, 
        'highwayOnly': false, 
        'distanceUnits': 'Miles', 
        'tollDiscourage': true
    } 
});