How to get distance between geometries in ArcGIS JS 4.10?

12-14-2018 11:59 AM
New Contributor III

I have a Feature Layer that contains polyline geometries and I have a point. I am trying to find the closest polyline to that point.

I have looked for a way to do this and I have found FindNearest and it looks like it can accomplish what I need to do:

However, it doesn't look like this exists in ArcGIS API for JS 4.10. Has this been replaced with something else? Is there anything I can use in 4.10 instead of FindNearest?


Tags (1)
0 Kudos
1 Reply
MVP Esteemed Contributor


   As of yet the analysis library is not part of the 4.x API. The closest thing available is nearestVertex

geometryEngine | API Reference | ArcGIS API for JavaScript 4.10 

But this method only take a simple geometry and a Point as input and returns the nearest point from the input geometry.  Meaning you would have to loop through each of the layer geometries to find the one with the least distance.