Directions

The Directions widget provides a quick and efficient way to calculate directions between two or more locations. The widget generates a route finding a least-cost path between two or more locations using a specified network service. The Directions widget is preconfigured to work with the network analysis services.

Configurable attributes

The following table describes the configurable attributes of the Directions widget.

AttributeDescription

routeTaskUrl

String. The URL for the network route service. The default service could be either of them:

  • For an ArcGIS Online organization, it is http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World.
  • For an ArcGIS Enterprise portal, it is the route service set in the utility services.

geocoderOptions

Object. Defines geocoder options. There is no default.

  • autoComplete: Boolean. The value indicating whether autocomplete is enabled. The default is true.
  • maxLocations: Number. Maximum number of locations to display in the results menu. The default value is 6.
  • minCharacters: Number. Minimum number of characters entered into the search field before querying for results. The default value is 3.
  • searchDelay: Number. Number of milliseconds before querying for results. The default value is 350.
  • arcgisGeocoder: Boolean or object. If true, the Directions widget uses the Esri World Locator to find search locations. The default value is false.
  • geocoders: Object[]. Each element of geocoders has two attributes: one is url, which is the URL for the geocoding service, and the other is placeholder, which is the placeholder text that will appear in the input box. There is no default value.

routeOptions

Object. Defines route options. There is no default.

  • directionsLanguage: String. The language is used when computing directions. There is no default.
  • directionsLengthUnits: String. The length units to use when computing directions. The default value is esriKilometers.
  • directionsOutputType: String. Defines the amount of direction information returned. Available values are complete, complete-no-events, instructions-only, standard, and summary-only. The default value is standard.
  • impedanceAttribute: String. The network attribute name to be used as the impedance attribute in analysis. You can specify any attribute names listed in the Service Directory under Network Dataset > Network Attributes as Usage Type: esriNAUTCost. You can also specify a value of none to indicate that no network attributes should be used for impedance. There is no default value.

Example

{
  "routeTaskUrl": "http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",
  "routeOptions": {
    "directionsLanguage": "de",
    "directionsLengthUnits": "esriKilometers",
    "directionsOutputType": "standard",
    "impedanceAttribute": "sdfasf"
  },
  "geocoderOptions": {
    "autoComplete": true,
    "maxLocations": 6,
    "minCharacters": 3,
    "searchDelay": 350,
    "arcgisGeocoder": false,
    "geocoders": [
      {
        "url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
        "placeholder": "asdfasdfasdfa"
      }
    ]
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.