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|String | 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 point barriers loaded as network locations during analysis. 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 | Indicates whether the service should generate driving directions for each route. 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 | |
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 | |
String | Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. 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
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.
- 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.
- 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.
- When
- 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
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.
- 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 theMaximumAllowableOffset
parameter and generalization is performed according toIPolycurve.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 Value Description none No lines are returned straight Only returns straight lines true-shape Return the true shape of the lines true-shape-with-measure Return the true shape of the lines with their measurements Possible Values:"none"|"straight"|"true-shape"|"true-shape-with-measure"
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 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.
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.
- preserveFirstStop Boolean
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.
- preserveLastStop Boolean
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.
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.
- 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 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.
- travelMode StringSince: ArcGIS API for JavaScript 4.10
Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.
- 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
Name | Return Type | Summary | Class | |
---|---|---|---|---|
* | 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 details | RouteParameters | |
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | RouteParameters |
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 ObjectA 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:Type Description * 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:Type Description Object The 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.