How do I display routing directions on the map without clicking the mapView
I already have the routing coordinates in my code which are dynamic
I just want to display it on the map without clicking the map
Hi @ElohoKennedy, you have two options: RouteLayer and Directions widget, or just the RouteLayer.
You can dynamically update the Directions widget with programmatically created RouteLayers. Here's a blog and a demo covering this functionality. Routing directions are displayed inside the Directions widget:
https://www.esri.com/arcgis-blog/products/js-api-arcgis/developers/changing-directions/
https://noashx.github.io/blog/ChangingDirections.html
You could also just use the RouteLayer, and then handle the display of the directions yourself.
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-routelayer
To display the directions, you'll want to work with the results of RouteLayer.solve():
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html#solve
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html#RouteLayerSolveResult
https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RouteInfo.html
Hope this helps!
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.