require(["esri/tasks/support/RouteParameters"], function(RouteParameters) { /* code goes here */ });
Class: esri/tasks/support/RouteParameters
Inheritance: RouteParameters Accessor
Since: ArcGIS API for JavaScript 4.0

Input parameters for RouteTask. Specifies details such as stop locations, barrier locations, the impedance attribute, etc.

See also:

Constructors

new RouteParameters(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
String[]

The list of network attribute names to be accumulated with the analysis.

more details
more detailsRouteParameters
AttributeParamValue[]

Each element in the array is an object that describes the parameter values.

more details
more detailsRouteParameters
DataLayer|FeatureSet

The set of point barriers loaded as network locations during analysis.

more details
more detailsRouteParameters
String

The name of the class.

more details
more detailsAccessor
String

The language used when computing directions.

more details
more detailsRouteParameters
String

The length units to use when computing directions.

more details
more detailsRouteParameters
String

Defines the amount of direction information returned.

more details
more detailsRouteParameters
String

The style to be used when returning directions.

more details
more detailsRouteParameters
String

The name of network attribute to use for the drive time when computing directions.

more details
more detailsRouteParameters
Boolean

If true, avoids network elements restricted by barriers or restrictions specified in restrictionAttributes.

more details
more detailsRouteParameters
Boolean

The RouteTask can help you find the most efficient path for visiting a given list of stops.

more details
more detailsRouteParameters
Boolean

In routes where a stop is not located on a network or a stop could not be reached, the results will differ depending on the value of this property:

  • When false, the solve operation will fail if at least one of the stops specified cannot be located or reached.
more details
more detailsRouteParameters
String

The network attribute name to be used as the impedance attribute in the analysis.

more details
more detailsRouteParameters
Number

The precision of the output geometry after generalization.

more details
more detailsRouteParameters
String

The units of the output geometry precision.

more details
more detailsRouteParameters
String

The type of output lines to be generated in the result.

more details
more detailsRouteParameters
SpatialReference|String

The well-known ID of the spatial reference for the geometries returned with the analysis results.

more details
more detailsRouteParameters
DataLayer|FeatureSet

The set of point barriers loaded as network locations during analysis.

more details
more detailsRouteParameters
DataLayer|FeatureSet

The set of polygon barriers loaded as network locations during analysis.

more details
more detailsRouteParameters
DataLayer|FeatureSet

The set of polyline barriers loaded as network locations during analysis.

more details
more detailsRouteParameters
Boolean

If true, keeps the first stop fixed in the sequence even when findBestSequence = true.

more details
more detailsRouteParameters
Boolean

If true, keeps the last stop fixed in the sequence even when findBestSequence = true.

more details
more detailsRouteParameters
String[]

The list of network attribute names to be used as restrictions with the analysis.

more details
more detailsRouteParameters
String

Specifies how U-Turns should be handled.

more details
more detailsRouteParameters
Boolean

If true, barriers are returned with the RouteResult.

more details
more detailsRouteParameters
Boolean

Indicates whether the service should generate driving directions for each route.

more details
more detailsRouteParameters
Boolean

If true, polygon barriers are returned in the RouteResult.

more details
more detailsRouteParameters
Boolean

If true, polyline barriers are returned in the RouteResult.

more details
more detailsRouteParameters
Boolean

If true, routes are generated and returned in the route property of each RouteResult.

more details
more detailsRouteParameters
Boolean

If true, stops are returned in the stops property of each RouteResult.

more details
more detailsRouteParameters
Boolean

If true, z values are returned in the RouteResult.

more details
more detailsRouteParameters
Date

The time the route begins.

more details
more detailsRouteParameters
Boolean

If true, the start time will be in UTC format.

more details
more detailsRouteParameters
DataLayer|FeatureSet

The set of stops loaded as network locations during analysis.

more details
more detailsRouteParameters
String

Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.

more details
more detailsRouteParameters
Boolean

If true, the hierarchy attribute for the network should be used in analysis.

more details
more detailsRouteParameters
Boolean

A useful feature of the RouteTask is the ability to constrain stop visits to certain times of day, or "time windows".

more details
more detailsRouteParameters

Property Details

accumulateAttributes String[]

The list of network attribute names to be accumulated with the analysis. For example, which attributes should be returned as part of the response. The default is as defined in the specific routing network layer used in your RouteTask. You can specify any attribute names listed in the Service Directory under Network Dataset -> Network Attributes as Usage Type: esriNAUTCost. See also Understanding the network attribute.

attributeParameterValues AttributeParamValue[]

Each element in the array is an object that describes the parameter values.

Deprecated since version 4.11.

The set of point barriers loaded as network locations during analysis. At ArcGIS Server 10.1 an optional url property was added. Use this property to specify a REST query request to a Feature, Map or GP Service that returns a JSON feature set. The url property can be specified using DataFile. Note that either the features or url property should be specified.

declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

directionsLanguage String

The language used when computing directions. The default is as defined in the specific routing network layer used in your RouteTask. By default, NAServer gets installed with en_US only - it is up to the server administrator to add additional languages.

directionsLengthUnits String

The length units to use when computing directions. The default is as defined in the specific routing network layer used in your RouteTask.

Possible Values:"centimeters"|"decimal-degrees"|"decimeters"|"feet"|"inches"|"kilometers"|"meters"|"miles"|"millimeters"|"nautical-miles"|"points"|"yards"

directionsOutputType String

Defines the amount of direction information returned.

Possible Values:"complete"|"complete-no-events"|"instructions-only"|"standard"|"summary-only"

directionsStyleName String

The style to be used when returning directions. The default will be as defined in the network layer. View the REST layer description for your network service to see a list of supported styles.

directionsTimeAttribute String

The name of network attribute to use for the drive time when computing directions. The default is as defined in the specific routing network layer used in your RouteTask.

doNotLocateOnRestrictedElements Boolean

If true, avoids network elements restricted by barriers or restrictions specified in restrictionAttributes.

Default Value:true
findBestSequence Boolean

The RouteTask can help you find the most efficient path for visiting a given list of stops. This is sometimes known as the "traveling salesperson" problem. When the findBestSequence = true, the route solver is solving the Traveling Salesperson problem by computing the optimal sequence to visit the stops. As this is a combinatorial problem, we employ heuristics to solve this in a reasonable time. The heuristics do not guarantee the optimal sequence (as there is no good/fast way to prove optimality for large number of stops). It returns a solution that is close to optimal if not the optimal. The heuristic performs favorably when tested with known TSP benchmarks available in the OR research community. For these stops to be visited in the most efficient way, specify the following parameters:

routeParams.findBestSequence = true;
routeParams.preserveFirstStop = false;
routeParams.preserveLastStop = false;
routeParams.returnStops = true;
ignoreInvalidLocations Boolean

In routes where a stop is not located on a network or a stop could not be reached, the results will differ depending on the value of this property:

  • When false, the solve operation will fail if at least one of the stops specified cannot be located or reached.
  • When true, as long as there are at least two valid stops that have been connected by a route, a valid result is returned. If multiple routes are processed in a single request, as long as least one route is built, a valid result is returned.
impedanceAttribute String

The network attribute name to be used as the impedance attribute in the analysis. The default is as defined in the specific routing network layer used in your RouteTask. 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. If you specify an empty array, it will default to the default of the service.

For example, set impedanceAttribute = "Time" for the quickest route and impedanceAttribute = "Length" for shortest drive, assuming the service has those two esriNAUTCost attributes.

For more information, see Understanding the network attribute.

outputGeometryPrecision Number

The precision of the output geometry after generalization. If 0, no generalization of output geometry is performed. If present and positive, it represents the MaximumAllowableOffset parameter and generalization is performed according to IPolycurve.Generalize.

outputGeometryPrecisionUnits String

The units of the output geometry precision.

Possible Values:"centimeters"|"decimal-degrees"|"decimeters"|"feet"|"inches"|"kilometers"|"meters"|"miles"|"millimeters"|"nautical-miles"|"points"|"yards"

outputLines String

The type of output lines to be generated in the result. The default is as defined in the specific routing network layer used in your RouteTask.

Possible ValueDescription
noneNo lines are returned
straightOnly returns straight lines
true-shapeReturn the true shape of the lines
true-shape-with-measureReturn the true shape of the lines with their measurements

Possible Values:"none"|"straight"|"true-shape"|"true-shape-with-measure"

outSpatialReference SpatialReference|String

The well-known ID of the spatial reference for the geometries returned with the analysis results. If not specified, the geometries are returned in the spatial reference of the map.

pointBarriers DataLayer|FeatureSet

The set of point barriers loaded as network locations during analysis. At ArcGIS Server 10.1 an optional url property was added. Use this property to specify a REST query request to a Feature, Map or GP Service that returns a JSON feature set. The url property can be specified using DataFile. Note that either the features or url property should be specified.

polygonBarriers DataLayer|FeatureSet

The set of polygon barriers loaded as network locations during analysis. At ArcGIS Server 10.1, an optional url property was added. Use this property to specify a REST query request to a Feature, Map or GP Service that returns a JSON feature set. The url property can be specified using DataFile. Note that either the features or url property should be specified.

polylineBarriers DataLayer|FeatureSet

The set of polyline barriers loaded as network locations during analysis. At ArcGIS Server 10.1, an optional url property was added. Use this property to specify a REST query request to a Feature, Map or GP Service that returns a JSON feature set. The url property can be specified using DataFile. Note that either the features or url property should be specified.

preserveFirstStop Boolean

If true, keeps the first stop fixed in the sequence even when findBestSequence = true. Only applicable if findBestSequence = true. The default is as defined in the specific routing network layer used in your RouteTask.

preserveLastStop Boolean

If true, keeps the last stop fixed in the sequence even when findBestSequence = true. Only applicable if findBestSequence = true. The default is as defined in the specific routing network layer used in your RouteTask.

restrictionAttributes String[]

The list of network attribute names to be used as restrictions with the analysis. The default is as defined in the specific routing network layer used in your RouteTask. Possible values are listed in the Service Directory under Network Dataset -> Network Attributes. You can also specify a value of none to indicate that no network attributes should be used as restrictions. If you specify an empty array, it will default to the default of the service.

restrictUTurns String

Specifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your RouteTask.

Possible Values:"allow-backtrack"|"at-dead-ends-only"|"no-backtrack"|"at-dead-ends-and-intersections"

returnBarriers Boolean

If true, barriers are returned with the RouteResult.

Default Value:false
returnDirections Boolean

Indicates whether the service should generate driving directions for each route.

Default Value:false
returnPolygonBarriers Boolean

If true, polygon barriers are returned in the RouteResult.

Default Value:false
returnPolylineBarriers Boolean

If true, polyline barriers are returned in the RouteResult.

Default Value:false
returnRoutes Boolean

If true, routes are generated and returned in the route property of each RouteResult.

Default Value:true
returnStops Boolean

If true, stops are returned in the stops property of each RouteResult.

Default Value:false
returnZ Boolean

If true, z values are returned in the RouteResult.

Default Value:true
startTime Date

The time the route begins. If not specified, the default is the time specified in the route service.

startTimeIsUTC Boolean

If true, the start time will be in UTC format.

Default Value:true

The set of stops loaded as network locations during analysis. When stops takes a FeatureSet, each feature in the FeatureSet must have a defined spatial reference. If the feature contains x and y attributes, those values are used for the stop, even if the feature includes geometry.

At ArcGIS Server 10.1 an optional url property was added. Use this property to specify a REST query request to a Feature, Map or GP Service that returns a JSON feature set. The url property can be specified using DataFile Note that either the features or url property should be specified.

travelMode String
Since: ArcGIS API for JavaScript 4.10

Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.

See also:
useHierarchy Boolean

If true, the hierarchy attribute for the network should be used in analysis. The default is as defined in the specific routing network layer used in your RouteTask.

Default Value:false
useTimeWindows Boolean

A useful feature of the RouteTask is the ability to constrain stop visits to certain times of day, or "time windows". If you were required to deliver orders to four homes and each customer was available during a limited time period during the day, the route task could help you find the most efficient path for making all the deliveries.

Time windows are treated as a "soft" constraint. This means that although the solver attempts to honor time windows, if necessary, it will violate the time windows of some stops in order to reach them. Remember, the stops will be visited in the order they were added unless you set RouteParameters.findBestSequence = true.

Default Value:false

Method Overview

NameReturn TypeSummaryClass
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more detailsRouteParameters
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsRouteParameters

Method Details

fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() topic in the Guide for more information.

Returns:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

Type Definitions

AttributeParamValue Object

An object describing the parameter values for the attributeParameterValues property of RouteParameters.

Properties:
attributeName String

The name of the attribute.

parameterName String

The name of the parameter.

value String

The parameter's value.

API Reference search results

NameTypeModule
Loading...