Dears
I am seeking your assistance in directing me to a tutorial with examples if about how to call and use optimum routing for single or multiple deliveries using Python calls.
Best Regards
@QassimNasirReview the material on this page https://developers.arcgis.com/documentation/mapping-apis-and-services/routing/optimized-routing/ and select ArcGIS API for Python in the code switchers to see the Python code.
Many thanks
Unforuntely, I find only those
ArcGIS Maps SDK for Kotlin
ArcGIS Maps SDK for Swift
ArcGIS Maps SDK for .NET
ArcGIS Maps SDK for Qt
I could not find Python in there.
Thank you so much. That code can be used for Enterprise as well?
# Connect to the routing service and call it
api_key = "YOUR_API_KEY"
portal = arcgis.GIS("https://www.arcgis.com", api_key=api_key)
route = arcgis.network.RouteLayer(
portal.properties.helperServices.route.url, gis=portal
)
result = route.solve(
stops=stops,
start_time="now",
find_best_sequence=True,
)
print_result(result)
if __name__ == "__main__":
main()
Hi @QassimNasir , the code I referred you to cannot be used with ArcGIS Enterprise because API keys are not supported. In that case you should use username and password when creating portal.
portal = arcgis.GIS("https://www.arcgis.com", username="<USERNAME>", password="<PASSWORD>")