get driving distance

1309
1
08-24-2016 11:05 AM
ThomasDunajski
New Contributor

Hi,

I need the driving distance between 2 points in js. I found this:
 Analysis - Calculate travel time and distance | ArcGIS API for JavaScript 3.17 
But I can't find anything in the 4.0 api. I actually don't need a map, just the driving distance. Anything I found in the 4.0 documentation is about getting the 'shortest' or 'euclidean' distance. If anybody can point me towards a piece of documentation id be grateful

0 Kudos
1 Reply
nita14
by
Occasional Contributor III

Indeed, it is already in 4.0. Sample guide: Simple Routing - RouteTask | ArcGIS API for JavaScript 4.0 . Open it in Sandbox and put console.log(routeResult.attributes.Total_Kilometers) in 118 line.

Hope this helps,

Adam