Query Distance Results REST Service

441
1
01-07-2021 12:23 PM
RenéGonzalez
New Contributor II

When querying a layer with the distance parameter, is there a way I can sort the results with the closest feature as the top candidate? 

For example, I want to find the nearest Land Use polygon to a point from a geocode point result on the street centerline (We are querying this layer with 911 dispatch callers to find out the type of land use for unit assignment). We want the top candidate in the results to be the closest land use type (Residential vs Commercial). 

By default, it doesn't sort the results by distance and can cause some issues when we do unit assignment.

Here is a screenshot of my parameters; The geocoding point is actually closer to Commercial but the top candidate shows Residential.

RenéGonzalez_8-1610050710421.png

RenéGonzalez_9-1610050762571.png

Any feedback would be greatly appreciated! 

Thank you

Tags (1)
1 Reply
StanislausCounty
New Contributor III

I realize this thread is a bit old but it is still a great question. If you are just dealing with points you can calculate the distance from one point to another and sort by that. For lines or polygons you could find the distance between the input point and each coordinate node within each response and take the lowest value. The caveat there would be that a feature node exists nearest the input point. If you had cases like this you could calculate the distance between each feature node and if the distance between those nodes is greater than a certain accuracy threshold calculate a middle node to compare against the input node, repeating the process until the distances between feature nodes meets or exceeds the accuracy threshold. Then you could compare the distance between each point and the input.

0 Kudos