The Directions widget provides a quick and efficient method of calculating turn-based directions between two or more locations. This widget uses both a network route service and a geocoder service.
The ArcGIS Online network analysis services require an ArcGIS Online organization subscription. If you choose to work with this by default, specify a valid user name and password for ArcGIS Online. Each successful request to the service incurs service credits taken from your subscription. In addition, if you have an ArcGIS Server network analysis service, you can also specify the URL.
The ArcGIS Online real-time traffic map services require an ArcGIS Online organization subscription. If you choose to work with this, specify a valid user name and password for ArcGIS Online. Each successful request to the service incurs service credits taken from your subscription.
If you want to share your secure service item with the public, for example, as part of a public web app, store the credentials with the item so the public is not required to log in to access your app. See ArcGIS Server web services for more information.
Configure the Directions widget
This widget can be set to open automatically when an app starts. To enable this feature, click the Open this widget automatically when the app starts button on the widget, which turns it dark green.
- Hover over the widget and click the Configure this widget button to open the configuration properties dialog box.
- Update Geocoder options. Default values from the services populate the options.
- Check Auto complete to have the search text box fill in possible addresses automatically by querying the geocoder service.
- Use Search delay to control how long the UI pauses before updating the list of candidate locations after the last key is pressed.
- Maximum suggestions controls the number of suggested locations returned from the geocoder service.
- Minimum characters determines the minimum number of characters required to query for suggested locations.
- The Placeholder text displays in the address lookup text box when no text has been entered.
- Update Route options. Default values from the services populate the options.
- Directions language is the culture code (for example, en_US for American English, de_DE for German). Output is customized for the specified locale if available.
- Use Directions output type to control the verbosity of the directions.
- Directions length units are the units of measure used when computing direction distances.
- Impedance attribute is the network attribute used for impedance. For example, set it to Time for the quickest route or Length for the shortest drive if the service has these attributes available. With an empty array, it defaults to the default of the service.
- Under Preset stops, preset the start and end points by typing the addresses or places in the text box.
- Click OK to close the dialog box.
By default, the route, geocoder, travel modes, and traffic layer URLs are from your organization or the utility services of Portal for ArcGIS. The travel modes and traffic layer URLs are optional. If the former is not specified, you will still see the default travel modes with the route URL when using the widget. If the latter is not specified, you will not see the traffic options when using the widget.
The example URLs that are unavailable in the Travel Modes URL and Traffic Layer URL text boxes can be used to enable default travel modes and traffic layers.
If you want the Directions widget to be publicly accessible, see Subscriber content access.
Use the Directions widget
Using the ArcGIS Online network analysis services consumes credits. Verify that you are signed in to your organization with privileges to perform network analysis.
Note:Now you can open the Directions widget by clicking the Open route button in the pop-up, where a route is generated by the Plan Routes tool from the Analysis widget. Make sure the Include route layers box is checked when running the Plan Routes tool.
- Click the directions icon to open the Directions widget.
- Enter the start and end destinations if they are not preset.
- Type the addresses in the fields, which may autocomplete addresses and locations, depending on the configuration.
- Add destinations by clicking the icon to enable it, and clicking the map.
- Optionally click the Reverse directions button to reorder the origin and destination.
- Optionally add more destinations by clicking Add. Each destination can also be dragged onto the map. Note that the Reverse directions button does not appear when there are more than two destinations.
- Optionally click the barriers icon and start to draw lines or polygons on the map to create barriers.
- Select a travel mode from the drop-down list if applicable. The default mode is Driving Time.
- If the specified travel mode is time-based and supports live traffic data—for example, Driving Time—choose a departure option of Leave Now or Depart At. If you choose Depart At, select a departure time and date. The departure time is set in the time zone of the place of departure.
- Click Options to display more options. Check Return to start to create a round-trip route. If available, check Show traffic to factor real-time traffic conditions into the total time of your route. Toggle between MI (miles) and KM (kilometers) to control the units used to report distances in the generated set of directions.
- Click Get Directions.
The map updates to display the route, and the directions display in the Directions widget.
- Each turn in the directions list is interactive. Click a turn to zoom to that location on the map. The route leading to that turn also highlights on the map.
- Click the print icon to open the directions in a new window for printing.
- To clear the current set of directions from the map, click Clear next to Get Directions.