Hello everybody,
I am new for ArcGIS JS development. I want to get the travel time between 2 or more stops using ArcGIS API for JS, but I don't know which API I could use.
I have the network server pulished by myself and it has the fields of road length and speed limit. I just want to get the travel time between 2 places.
Appreciate for any suggestion.
Lin
Solved! Go to Solution.
Also,
This sample may help as well:
Get driving directions | ArcGIS API for JavaScript
Here's the money line for travel time:
var totalLength = number.format(directions.totalTime);
Note, the sample isn't actually doing anything with it, but it does return (verified by console.log).
Lin,
There's an Esri sample for travel time:
Analysis - Calculate travel time and distance | ArcGIS API for JavaScript
This particular sample uses ConnectOriginsToDestinations , which is "...part of the Analysis service in ArcGIS Online.Analysisis a subscription-based service available through ArcGIS Online".
You mentioned you have the network service available; I would have a look at RouteTask | API Reference | ArcGIS API for JavaScript
Note, you will need ArcGIS Server 9.3.1+ You cannot use an earlier version of ArcGIS Server if you wish to use RouteTask in the JSAPI.
Here's a sample:
Also,
This sample may help as well:
Get driving directions | ArcGIS API for JavaScript
Here's the money line for travel time:
var totalLength = number.format(directions.totalTime);
Note, the sample isn't actually doing anything with it, but it does return (verified by console.log).
Thank you very much for your advice! I will try those methods and my ArcGIS Server is 10.2.^.^