RouteParameters
require(["esri/tasks/support/RouteParameters"], function(RouteParameters) { /* code goes here */ });
esri/tasks/support/RouteParameters
Input parameters for RouteTask. Specifies details such as stop locations, barrier locations, the impedance attribute, etc.
Constructors
- new RouteParameters(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String[] | The list of network attribute names to be accumulated with the analysis. more details | more details | RouteParameters | |
AttributeParamValue | Each element in the array is an object that describes the parameter values. more details | more details | RouteParameters | |
DataLayer | FeatureSet | The set of point barriers loaded as network locations during analysis. more details | more details | RouteParameters | |
String | The name of the class. more details | more details | Accessor | |
String | The language used when computing directions. more details | more details | RouteParameters | |
String | The length units to use when computing directions. more details | more details | RouteParameters | |
String | Defines the amount of direction information returned. more details | more details | RouteParameters | |
String | The style to be used when returning directions. more details | more details | RouteParameters | |
String | The name of network attribute to use for the drive time when computing directions. more details | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | The RouteTask can help you find the most efficient path for visiting a given list of stops. more details | more details | RouteParameters | |
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:
| more details | RouteParameters | |
String | The network attribute name to be used as the impedance attribute in the analysis. more details | more details | RouteParameters | |
Number | The precision of the output geometry after generalization. more details | more details | RouteParameters | |
String | The units of the output geometry precision. more details | more details | RouteParameters | |
String | The type of output lines to be generated in the result. more details | more details | RouteParameters | |
SpatialReference | The well-known ID of the spatial reference for the geometries returned with the analysis results. more details | more details | RouteParameters | |
DataLayer | FeatureSet | The set of polygon barriers loaded as network locations during analysis. more details | more details | RouteParameters | |
DataLayer | FeatureSet | The set of polyline barriers loaded as network locations during analysis. more details | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
String[] | The list of network attribute names to be used as restrictions with the analysis. more details | more details | RouteParameters | |
String | Specifies how U-Turns should be handled. more details | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
Date | The time the route begins. more details | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
DataLayer | FeatureSet | The set of stops loaded as network locations during analysis. more details | more details | RouteParameters | |
Boolean | If | more details | RouteParameters | |
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 details | RouteParameters |
Property Details
- accumulateAttributesString[]
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
asUsage Type: esriNAUTCost
. See also Understanding the network attribute.
- attributeParameterValuesAttributeParamValue
Each element in the array is an object that describes the parameter values.
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.
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
- directionsLanguageString
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.
- directionsLengthUnitsString
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
- directionsOutputTypeString
Defines the amount of direction information returned.
Possible Values: complete | complete-no-events | instructions-only | standard | summary-only
- Default Value:standard
- directionsStyleNameString
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.
- directionsTimeAttributeString
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.
- doNotLocateOnRestrictedElementsBoolean
If
true
, avoids network elements restricted by barriers or restrictions specified in restrictionAttributes.- Default Value:true
- findBestSequenceBoolean
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;
- ignoreInvalidLocationsBoolean
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.
- When
- impedanceAttributeString
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
asUsage Type: esriNAUTCost
. You can also specify a value ofnone
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 andimpedanceAttribute = "Length"
for shortest drive, assuming the service has those two esriNAUTCost attributes.For more information, see Understanding the network attribute.
- outputGeometryPrecisionNumber
The precision of the output geometry after generalization. If
0
, no generalization of output geometry is performed. If present and positive, it represents theMaximumAllowableOffset
parameter and generalization is performed according toIPolycurve.Generalize
.
- outputGeometryPrecisionUnitsString
The units of the output geometry precision.
Possible Values: centimeters | decimal-degrees | decimeters | feet | inches | kilometers | meters | miles | millimeters | nautical-miles | points | yards
- outputLinesString
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 Values: none | straight | true-shape | true-shape-with-measure
- Default Value:true-shape
- outSpatialReferenceSpatialReference
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.
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 thefeatures
orurl
property should be specified.
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 thefeatures
orurl
property should be specified.
- preserveFirstStopBoolean
If
true
, keeps the first stop fixed in the sequence even whenfindBestSequence = true
. Only applicable iffindBestSequence = true
. The default is as defined in the specific routing network layer used in your RouteTask.
- preserveLastStopBoolean
If
true
, keeps the last stop fixed in the sequence even whenfindBestSequence = true
. Only applicable iffindBestSequence = true
. The default is as defined in the specific routing network layer used in your RouteTask.
- restrictionAttributesString[]
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 ofnone
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.
- restrictUTurnsString
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
- See also:
- returnBarriersBoolean
If
true
, barriers are returned with the RouteResult.- Default Value:false
- returnDirectionsBoolean
If
true
, barriers are returned in the directions property of each RouteResult.- Default Value:false
- returnPolygonBarriersBoolean
If
true
, polygon barriers are returned in the RouteResult.- Default Value:false
- returnPolylineBarriersBoolean
If
true
, polyline barriers are returned in the RouteResult.- Default Value:false
- returnRoutesBoolean
If
true
, routes are generated and returned in the route property of each RouteResult.- Default Value:true
- returnStopsBoolean
If
true
, stops are returned in the stops property of each RouteResult.- Default Value:false
- returnZBoolean
If
true
,z
values are returned in the RouteResult.- Default Value:true
- startTimeDate
The time the route begins. If not specified, the default is the time specified in the route service.
- startTimeIsUTCBoolean
If
true
, the start time will be in UTC format.
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 containsx
andy
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. Theurl
property can be specified using DataFile Note that either the features or url property should be specified.
- useHierarchyBoolean
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.
- useTimeWindowsBoolean
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
.
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | RouteParameters |
Method Details
- 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:Type Description Object The ArcGIS portal JSON representation of an instance of this class.
Type Definitions
- AttributeParamValueObject
An object describing the parameter values for the attributeParameterValues property of RouteParameters.