When we receive an incident request, we need to find the nearest facility to that address. By the time we go to search, we have already converted the address to a set of coordinates. I have a layer with my facilities. What's the best way to find the nearest facility using the runtime SDK for QT.
Solved! Go to Solution.
You can use ClosestFacilityTask.
Here is a sample in QML - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Routing/ClosestFacility at master · Esri/arc...
And here is the C++ version - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Routing/ClosestFacility at master · Esri/arc...
In our samples, we use mouse click to get the coordinates, but in your case, you can just create a Point object from the coordinates you have instead.
You can use ClosestFacilityTask.
Here is a sample in QML - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Routing/ClosestFacility at master · Esri/arc...
And here is the C++ version - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Routing/ClosestFacility at master · Esri/arc...
In our samples, we use mouse click to get the coordinates, but in your case, you can just create a Point object from the coordinates you have instead.
I notice you create points manually. In my case the points are in a layer on the ArcGIS server. Is there a way to iterate through that?
Yup, we show that type of workflow here :