Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to add the Directions widget.

The Directions widget makes it easy to calculate directions between two or more input locations. The resulting directions are displayed with detailed turn-by-turn instructions. The Clear route button calls the reset() method, which clears all the input stops and results in the widget and in the map.

How it works

This sample requires a proxy to handle communications with the routing service. This example uses an ArcGIS Online hosted proxy. You can either remove it and log in once prompted, or you can set up your own service proxy.

You must first enter input locations. A minimum of two, start and stop, are required. To enter the location, indicate which stop you are specifying by clicking in the dialog box where it states, Search or click on the map. If you have geolocation enabled in the browser, a prompt will also display in the dialog to Use current location. You can either use the current location, type in an address, or click on the map. If you choose the latter, a reverse geocoding occurs and the resulting address displays as a stop location.

After at least two stops are entered, the resulting directions route displays with turn-by-turn directions. In addition, you can also opt to get directions at a specified date and time by changing it from Leave now to Depart by.

Sample search results

TitleSample
Loading...