The Directions widget allows users to calculate turn-specific directions between two or more locations. Calculating a route generates an output data source that other widgets can use.
Examples
Use this widget to support app design requirements such as the following:
- You want city planners to calculate walking times from residential neighborhoods to public parks.
- You want emergency medical teams to plan routes to medical centers.
- You want supply chain managers to estimate when a truck must leave to arrive on time.
Usage notes
This widget requires a connection to a Map widget.
By default, the widget uses the ArcGIS World Route Service and the units defined in your account settings. Available tools vary depending on the route URL you provide in the widget settings. When you include the widget in an app, the default route settings provide users with the following tools for calculating directions:
-
Add a stop—Add a stop on the route. By default, the widget includes two stops. When there are three or more stops, users can use Remove stop to delete stops. Drag stops vertically to change their order. Search for an address or place-name to configure a stop.
-
Pick location on the map—Set the location for a stop by clicking a location on the map.
-
Reverse stops—When there are two stops, you can reverse their order.
-
Edit route—Manually edit the route by adding stops and barrier lines on the map. Barriers allow you to define parts of a road network that cannot be traversed. For example, if you know that a road on the current route is impassable because of rock fall, you can draw a barrier across that road and the widget will find a different route.
- Automatically solve—If you turn on this switch, the widget automatically updates the route after you add a new stop or barrier. If you leave the switch turned off, you can click Solve to update the route.
-
Time and distance—Choose a method of transportation, and whether to calculate the fastest route by distance or time. For example, selecting Driving Time calculates the most time-efficient route between two points, while selecting Driving Distance for the same two stops calculates the shortest route by distance.
-
Departure—Choose to include a specific departure time when calculating the route.
-
Optimize order—If you turn on this option, the widget calculates the best route using optimized routing and changes the order of the stops.
- Preserve first stop—Keep the original first stop as the first stop.
- Preserve last stop—Keep the original last stop as the last stop.
-
Result—Click the generated route to view a full list of directions.
- Clear—Remove all stops.
- Save and Save As—Save the resulting route as an ArcGIS Online item. Provide a name and choose a folder location for the new feature layer. Once you save the layer, you can click Save to update it or click View layer details to go to its item page.
Settings
The Directions widget includes the following settings:
-
Select a Map widget—Select a map widget.
-
Route Settings—Add a routing utility service. The widget settings list the URL for the ArcGIS World Route Service as an example.
-
Search settings—Add search sources and customize search options.
-
New search source—Optionally, add sources other than the default search source. Choose Layer source or Locator source and specify the following settings for each:
-
Select data (Layer sources only)—Select the data source you want users to use to search. The data source must be a point layer. Layer sources support searching to create a stop, but do not support clicking a feature on the map to create a stop.
-
Select utility (Locator sources only)—Add a geocoding utility service.
-
Label—Add a label for the search source.
-
Search options—You can set the following additional options:
-
Select searching fields (Layer sources only)—Choose one or more fields to search in the layer.
-
Exact match (Layer sources only)—Limit search results to only records that match the search phrase.
-
Display fields (Layer sources only)—Choose one or more fields to display in the search result panel. You can drag selected fields to reorder them.
-
Hint—Customize the hint text that appears in the search box when users choose to search with a single source.
-
Search in specific countries or regions (Locator sources only)—Enter a country code to narrow results to that country.
-
Only search in current map extent—Limit results to only include places or features within the current map extent.
-
-
-
Hint for multiple search sources—Customize the hint text that appears in the search box when users choose to search with multiple sources.
-
Maximum suggestions per source—Limit the number of searches that appear in the suggestion box for each locator source.
-
Use current location—Include a suggestion option to search for a stop based on the user's current location.
-
-
General settings—Configure general settings.
- Unit system—Choose a system of measurement for values displayed in the widget, either Imperial or Metric. By default, this is the system defined in your profile settings.
- Show runtime layers in layer lists—Show route layers created by the Directions widget in the layer lists of other widgets, such as the Map Layers widget, the Legend widget, and the Map widget Layers tool.
Interaction options
The Directions widget can interact with other widgets through data actions. Certain widgets, including the List and Table widgets, can target the Directions widget with the Directions From, Directions To, and Plan route data actions, which you can enable on the Action tab of those widgets' settings.
You can use the directions data actions to allow users to determine a route's start point, end point, or multiple points along a route by selecting point features.
To do this with a table, add a Table widget and a Directions widget to an app, then go to the Action tab of the Table widget's settings and turn on Directions From, Directions To, and Plan route under Data action. When the user selects features in the table and clicks the Actions button on the widget panel, the enabled data actions appear in a drop-down menu.