AnsweredAssumed Answered

RouteTask Travel Mode

Question asked by cory@nuvexcloud.ca on May 25, 2017
Latest reply on May 26, 2017 by cory@nuvexcloud.ca

I'm having an issue with the travel modes. I cant really find any documentation on it but i found other forum posts related to my problem and tried to make my own fix, it just does not seem like it is doing anything. 

 

I need the route that it returns from the solve() function to give me trucking routes instead of general ones. It actually looks like its just the first one that it finds, not even optimized for fastest/shortest route like most map routing software does. 

 

I've attached below the object that gets sent to the solve function if it helps anything. I got the travel mode object from running the getTravelModes function in the rest api. I then pasted it in to the travel mode attribute in the RouteParameter Object.

 

I've also tried setting the default mode in my account settings but that also does not seem to effect anything.

 

 

 

RouteParameter Object:

{
"returnDirections": true,
"returnRoutes": true,
"returnZ": true,
"returnStops": false,
"returnBarriers": false,
"returnPolygonBarriers": false,
"returnPolylineBarriers": false,
"outSR": 3857,
"outputLines": "esriNAOutputLineTrueShape",
"findBestSequence": false,
"travelMode": {
"attributeParameterValues": [
{
"parameterName": "Restriction Usage",
"attributeName": "Use Preferred Truck Routes",
"value": "PREFER_HIGH"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Unpaved Roads",
"value": "AVOID_HIGH"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Private Roads",
"value": "AVOID_MEDIUM"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Driving a Truck",
"value": "PROHIBITED"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Roads Under Construction Prohibited",
"value": "PROHIBITED"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Gates",
"value": "AVOID_MEDIUM"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Express Lanes",
"value": "PROHIBITED"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Carpool Roads",
"value": "PROHIBITED"
},
{
"parameterName": "Restriction Usage",
"attributeName": "Avoid Truck Restricted Roads",
"value": "AVOID_HIGH"
}
],
"description": "Models basic truck travel by preferring designated truck routes, and finds solutions that optimize travel time. Routes must obey one-way roads, avoid illegal turns, and so on.",
"impedanceAttributeName": "TruckTravelTime",
"simplificationToleranceUnits": "esriMeters",
"uturnAtJunctions": "esriNFSBNoBacktrack",
"restrictionAttributeNames": [
"Avoid Carpool Roads",
"Avoid Express Lanes",
"Avoid Gates",
"Avoid Private Roads",
"Avoid Truck Restricted Roads",
"Avoid Unpaved Roads",
"Driving a Truck",
"Roads Under Construction Prohibited",
"Use Preferred Truck Routes"
],
"useHierarchy": true,
"simplificationTolerance": 10,
"timeAttributeName": "TruckTravelTime",
"distanceAttributeName": "Kilometers",
"type": "TRUCK",
"id": "ZzzRtYcPLjXFBKwr",
"name": "Trucking Time"
},
"stops": "{\"type\":\"features\",\"features\":[{\"geometry\":{\"x\":-112.788894,\"y\":49.706994,\"spatialReference\":{\"wkid\":4326}},\"attributes\":{}},{\"geometry\":{\"x\":-112.84417,\"y\":49.707616,\"spatialReference\":{\"wkid\":4326}},\"attributes\":{}}],\"doNotLocateOnRestrictedElements\":true}"
}

Outcomes