Programatically Set Default TravelTime TravelMode in RouteTask

134
1
08-24-2020 08:01 AM
CamilleSevigny
New Contributor

Hi, I am trying to  programatically set/use the default travel mode of "TravelTime" in a RouteTask.

// Setup the route parameters
var routeParams = new RouteParameters({
   returnDirections: true,
   stops: new FeatureSet({
      features: view.graphics.toArray()
   }),
   travelMode: ?????? //How do I set this to a default TravelMode of "Travel Time", or "Drive Time", or "Truck"?
});
// Get the route
routeTask.solve(routeParams).then(function(data) {
   //Do Stuff Here......
});

Is it possible to use the default travel modes that arcGIS has for shortest time, shortest distance, and truck routing?

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

I think this is the documentation you are looking for:

RouteParameters | ArcGIS API for JavaScript 4.16 

Note that a valid travelMode property is will be dependent on the Network Analyst server to which the request is sent.

0 Kudos