JAVASCRIPT function to find nearest feature of a coordinate

1555
1
07-03-2020 04:35 AM
AdeebFarhan
New Contributor II

Dears

 

I have set of different coordinates in an excel file. I am processing this excel file through java script API. I am trying to find the nearest feature(using ESRI javascript API) corresponding to each coordinate in excel sheet. the nearest feature  I am looking for is in a map service(layer) published in arcgis server and accessible through it's rest API url.

Is there any ESRI javascript API function available for finding the nearest feature of the selected coordinate? 

 

I am using the arcgis javascript API version 3.14 (js.arcgis.com/3.14compact).

0 Kudos
1 Reply
Scanny
by
New Contributor

From my understanding neither 3.X or 4.X have the ability to do this (proximity analysis) client side out of the box. I have the same problem as you, and will likely used the REST API's Find Nearest functionality:

https://developers.arcgis.com/rest/analysis/api-reference/find-nearest.htm

 

Edit: In your case the following may be of interest, I haven't used 3.X so I can't be sure but it sounds close to what you are looking for: https://developers.arcgis.com/javascript/3/jssamples/routetask_closest_facility.html

 

0 Kudos