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 scene.
- Click on the RouteManager game object under ArcGISMap in the Hierarchy window.
- Set your API key in the Inspector window.
- Click play and left click on the map twice while holding shift. (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 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.)
- Unity's Line Renderer component is used to visualize the route segments between pairs of breadcrumbs.
routing, raycast, REST API