Find a route
Show a route between two points on a map using Esri's routing service REST API.
This sample uses Esri's routing service's REST API to query the closest route along the road network between two points. This service uses routing operations associated with your API Key. You can learn more about API keys and Accounts in the Mapping APIs and location services guide.
- Open the Routing level
- Click on the ArcGISMapActor in the Outliner panel.
- Set your API key under Authentication section in the Details panel.
- Click play and left-click on two locations on the map while holding shift. The route between the two points will be shown.
Note: This sample is only set up to work with mouse and keyboard.
HTTPClientis used to query the routing service's REST API.
- The sample makes a direct request to obtain the routing result.
- The Raycast API is used to determine the elevation at each breadcrumb's position to account for elevation. (Mesh colliders need to be enabled in the ArcGIS Map Component to use the Raycast API)
- Spline meshes are used to visualize the route segments between pairs of breadcrumbs.
routing, raycast, REST API