Find Nearest features from an input location

3197
4
02-20-2014 09:44 AM
GaneshSolai_Sambandam
New Contributor III
Hi Guys
I wanted to find the nearest features (it can be point, line and polygon layers) from an user input or search location and identify 5 nearest locations along with their distances.

Have anybody worked on this link below. If so, can anyone point me to the right sample application, please.

https://developers.arcgis.com/javascript/jsapi/findnearest-amd.html

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

On the above link,  there is no sample application or code to show how this works.

Secondly, there should be a way to do without using FindNearest class, as this class has only been introduced with V3.7.
If this is the case, then how GIS developers across the world would have created application without this class.

I think, some one should really have an answer to this.

Regards
Ganesh
0 Kudos
4 Replies
RobertoPepato
Occasional Contributor II
I think that you're looking for the closest facility task. Take a look at this link and see if it helps.

About performing a remote geoprocessing operation without using the client APIs, you can always talk directly to the REST API but I do not recommend this approach, unless you have good reasons to consider it. Remember that, if you talk directly with the REST API the de/serialization functions (and some other functions) are entirely on you.
0 Kudos
GaneshSolai_Sambandam
New Contributor III
I think that you're looking for the closest facility task. Take a look at this link and see if it helps.

About performing a remote geoprocessing operation without using the client APIs, you can always talk directly to the REST API but I do not recommend this approach, unless you have good reasons to consider it. Remember that, if you talk directly with the REST API the de/serialization functions (and some other functions) are entirely on you.


Hi Pepatosp
thank you very much for quick turnaround. The closest facility task would only work with point  features (in the near feature layer),
not sure whether it would work for lines and polygons. Correct me, If I am wrong. In my case, I would like to calculate distance between the input location and near features ( which can  be point, line and polygons). If the near feature is a line or polygon, then, it should  calculate the distance of the nearest vertices from the line or polygon rather than the centroid of the near line or polygon features.

I think, for this kind of analysis, We should use Generate Near Table in Arctoolbox and publish them as a Geoprocessing service.

this should help me solve the problem. Just wondering, if anyone, has published geoprocessing service like this and use them in their application. If so, can you point me to the right link, please. Or If there is any other better way of doing this, would also be of great help.

Regards
Ganesh

I
0 Kudos
RobertoPepato
Occasional Contributor II
Hi Pepatosp
thank you very much for quick turnaround. The closest facility task would only work with point  features (in the near feature layer),
not sure whether it would work for lines and polygons. Correct me, If I am wrong. In my case, I would like to calculate distance between the input location and near features ( which can  be point, line and polygons). If the near feature is a line or polygon, then, it should  calculate the distance of the nearest vertices from the line or polygon rather than the centroid of the near line or polygon features.

I think, for this kind of analysis, We should use Generate Near Table in Arctoolbox and publish them as a Geoprocessing service.

this should help me solve the problem. Just wondering, if anyone, has published geoprocessing service like this and use them in their application. If so, can you point me to the right link, please. Or If there is any other better way of doing this, would also be of great help.

Regards
Ganesh

I



Ganesh, you're right.

I misunderstood your requirements. When you said that you want to use any kind of feature, I've thought about using the polygon centroids (in case of polygons) and the line middle points. If you need the closest vertices, this solution won't work.

I don't know the how the arctoolbox tool that you talk works, so I think that I can't help here.
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Ganesh, you're right.

I misunderstood your requirements. When you said that you want to use any kind of feature, I've thought about using the polygon centroids (in case of polygons) and the line middle points. If you need the closest vertices, this solution won't work.

I don't know the how the arctoolbox tool that you talk works, so I think that I can't help here.


HI GIS folks,
Can you anyone give me a clue on this or point me the right sample application to work on.

Regards
Ganesh
0 Kudos