dojo.require("esri.tasks.RouteParameters")
Name | Summary |
---|---|
new esri.tasks.RouteParameters() | Creates a new RouteParameters object. |
Name | Type | Summary |
---|---|---|
accumulateAttributes | String[] | The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. |
attributeParameterValues | Object[] | Each element in the array is an object that describes the parameter values. |
barriers | Object | The set of point barriers loaded as network locations during analysis. |
directionsLanguage | String | The language used when computing directions. |
directionsLengthUnits | String | The length units to use when computing directions. |
directionsOutputType | String | Defines the amount of direction information returned. |
directionsStyleName | String | The style to be used when returning directions. |
directionsTimeAttribute | String | The name of network attribute to use for the drive time when computing directions. |
doNotLocateOnRestrictedElements | Boolean | If true, avoids network elements restricted by barriers or due to restrictions specified in restrictionAttributes . |
findBestSequence | Boolean | The RouteTask can help you find the most efficient path for visiting a given list of stops. |
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 ignoreInvalidLocations . |
impedanceAttribute | String | The network attribute name to be used as the impedance attribute in analysis. |
outSpatialReference | SpatialReference | The well-known ID of the spatial reference for the geometries returned with the analysis results. |
outputGeometryPrecision | Number | The precision of the output geometry after generalization. |
outputGeometryPrecisionUnits | String | The units of the output geometry precision. |
outputLines | String | The type of output lines to be generated in the result. |
polygonBarriers | Object | The set of polygon barriers loaded as network locations during analysis. |
polylineBarriers | Object | The set of polyline barriers loaded as network locations during analysis. |
preserveFirstStop | Boolean | If true, keeps the first stop fixed in the sequence even when findBestSequence is true. |
preserveLastStop | Boolean | If true, keeps the last stop fixed in the sequence even when findBestSequence is true. |
restrictUTurns | String | Specifies how U-Turns should be handled. |
restrictionAttributes | String[] | The list of network attribute names to be used as restrictions with the analysis. |
returnBarriers | Boolean | If true, barriers are returned as the second parameter of RouteTask.onSolveComplete . |
returnDirections | Boolean | If true, directions are generated and returned in the directions property of each RouteResult . |
returnPolygonBarriers | Boolean | If true, polygon barriers are returned as the third parameter of RouteTask.onSolveComplete . |
returnPolylineBarriers | Boolean | If true, polyline barriers are returned as the fourth parameter of RouteTask.onSolveComplete . |
returnRoutes | Boolean | If true, routes are generated and returned in the route property of each RouteResult . |
returnStops | Boolean | If true, stops are returned in the stops property of each RouteResult . |
startTime | Date | The time the route begins. |
startTimeIsUTC | Boolean | Start time is in UTC format (Added at v3.8). |
stops | Object | The set of stops loaded as network locations during analysis. |
timeWindowsAreUTC | Boolean | If true , the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). |
travelMode | Object | 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. |
useTimeWindows | Boolean | A useful feature of the RouteTask is the ability to constrain stop visits to certain times of day, or "time windows". |
String[]
> accumulateAttributesObject[]
> attributeParameterValuesrouteParams.attributeParameterValues = [ { attributeName: "Time", parameterName: "25 MPH", value: "2.5" }, { attributeName: "Time", parameterName: "35 MPH", value: "5.0" } ];
Object
> barriers//Add barriers as a FeatureSet routeParams.barriers = new esri.tasks.FeatureSet(); routeParams.barriers.features.push( map.graphics.add( new esri.Graphic( evt.mapPoint, barrierSymbol ) ) ); //Requires ArcGIS Server 10.1 or greater var networkServiceUrl = 'https://www.example.com/arcgis/rest/services/Network/USA/MapServer/' routeParams.barriers = new esri.tasks.DataFile({ url: networkServiceUrl + "/1/query?where=1%3D1&outFields=Name,RouteName&f=json"} );
String
> directionsLanguageString
> directionsLengthUnitsesriFeet | esriKilometers | esriMeters | esriMiles | esriNauticalMiles | esriYards
String
> directionsOutputTypecomplete | complete-no-events | instructions-only | standard | summary-only
standard
String
> directionsStyleNameString
> directionsTimeAttributeBoolean
> doNotLocateOnRestrictedElementsbarriers
or due to restrictions specified in restrictionAttributes
.true | false
false
Boolean
> findBestSequenceThe 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 is set to true
, the route solver is solving the Traveling Salesperson problem of 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.
If you want 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;
true | false
Boolean
> ignoreInvalidLocationsignoreInvalidLocations
. RouteTask.onSolveComplete
.
true | false
String
> impedanceAttributeimpedanceAttribute="Time"
for quickest route and impedanceAttribute="Length"
for shortest drive, assuming the service has those two esriNAUTCost attributes. SpatialReference
> outSpatialReferenceNumber
> outputGeometryPrecisionString
> outputGeometryPrecisionUnitsesriUnknownUnits | esriCentimeters | esriDecimalDegrees | esriDecimeters | esriFeet | esriInches | esriKilometers | esriMeters | esriMiles | esriMillimeters | esriNauticalMiles | esriPoints | esriYards
esriUnknownUnits
String
> outputLinesObject
> polygonBarriersrouteParams.polygonBarriers = new esri.tasks.FeatureSet(); //Create a symbol for the barriers var polygonBarrierSymbol = new esri.symbol.SimpleFillSymbol(); //Use the draw toolbar to generate polygons to add as barriers. drawToolbar.activate(esri.toolbars.Draw.POLYGON); var drawEnd_connect = dojo.connect(drawToolbar, "onDrawEnd", function(geometry) { routeParams.polygonBarriers.features.push( map.graphics.add(new esri.Graphic(geometry, polygonBarrierSymbol)) ); //Requires ArcGIS Server 10.1 or greater var networkServiceUrl = 'https://www.example.com/arcgis/rest/services/Network/USA/MapServer/'; routeParams.polygonBarriers = new esri.tasks.DataFile({ url: networkServiceUrl + "/7/query?where=1%3D1&outFields=Name,RouteName&f=json"} );
Object
> polylineBarriersrouteParams.polylineBarriers = new esri.tasks.FeatureSet(); //Create a symbol for the barriers var polylineBarrierSymbol = new esri.symbol.SimpleLineSymbol().setColor(new esri.Color([255,0,0])); //Use the draw toolbar to generate polylines to add as barriers. drawToolbar.activate(esri.toolbars.Draw.POLYLINE); var drawEnd_connect = dojo.connect(drawToolbar, "onDrawEnd", function(geometry) { routeParams.polylineBarriers.features.push( map.graphics.add(new esri.Graphic(geometry, polylineBarrierSymbol)) ); //Requires ArcGIS Server 10.1 or greater var networkServiceUrl = 'https://www.example.com/arcgis/rest/services/Network/USA/MapServer/'; lineBarriers = new esri.tasks.DataFile({ url: networkServiceUrl + "/6/query?where=1%3D1&outFields=Name,RouteName&f=json"} );
Boolean
> preserveFirstStopfindBestSequence
is true. Only applicable if findBestSequence
is true. The default is as defined in the specific routing network layer used in your RouteTask.true | false
Boolean
> preserveLastStopfindBestSequence
is true. Only applicable if findBestSequence
is true. The default is as defined in the specific routing network layer used in your RouteTask.true | false
String
> restrictUTurnsString[]
> restrictionAttributesBoolean
> returnBarriersRouteTask.onSolveComplete
.true | false
false
Boolean
> returnDirectionsdirections
property of each RouteResult
.true | false
false
Boolean
> returnPolygonBarriersRouteTask.onSolveComplete
.true | false
Boolean
> returnPolylineBarriersRouteTask.onSolveComplete
.true | false
Boolean
> returnRoutesroute
property of each RouteResult
.true | false
true
Boolean
> returnStopsstops
property of each RouteResult
.true | false
false
Date
> startTimeObject
> stopsRouteParameters.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.
//Add stops as a FeatureSet routeParams.stops = new esri.tasks.FeatureSet(); routeParams.stops.features.push( map.graphics.add( new esri.Graphic( evt.mapPoint, stopSymbol, { RouteName:dojo.byId("routeName").value } ) ) );
//Requires ArcGIS Server 10.1 or greater var networkServiceUrl = 'https://www.example.com/arcgis/rest/services/Network/USA/MapServer/'; routeParams.stops = new esri.tasks.DataFile({ url: networkServiceUrl + "/1/query?where=1%3D1&outFields=Name,RouteName&f=json"} );
Boolean
> timeWindowsAreUTCtrue
, the TimeWindowStart
and TimeWindowEnd
attributes of a stop are in UTC time (milliseconds). If false
, these two attribute values are in the time zone of the corresponding Stop. (Added at v3.17)null
Object
> travelModesupportedTravelModes
array returned by the RouteTask's getServiceDescription() method. Each Travel Mode is preset in the Network Analysis settings configured inside the network dataset, in a ArcGIS Online Organization, or inside a Portal for ArcGIS. (Added at v3.14)Null
travelMode
>< > attributeParameterValues |
Required | An array of objects used to identify specific vehicle characteristics or how soft to make each restriction. Each object will have the following properties: attributeName , parameterName , and value . For additional information regarding attribute parameters, see the ArcGIS Online help topic. |
< > description |
Required | A description of the travel mode used. |
< > distanceAttributeName |
Required | The restriction attributes to respect during analysis. A list of possible restrictions of the ArcGIS Online services is listed here. NOTE: Attribute names are specific to the network dataset. They may be different if using another Network Analysis service besides the one hosted via ArcGIS Online. |
< > id |
Required | Unique identifier for the travel mode. |
< > impedanceAttributeName |
Required | The cost attribute on which to optimize the analysis, for example "Miles", "Minutes", "Travel Time", "Kilometers", "TimeAt1KPH", "WalkTime", and "TruckTravelTime". NOTE: Attribute names are specific to the network dataset. They may be different if using another Network Analysis service besides the one hosted via ArcGIS Online. |
< > name |
Required | Name of the travel mode. Users of ArcGIS Online or Portal for ArcGIS can define custom Travel Modes inside their Organization settings. Authors of stand alone Network Analysis Services can define their own Travel Modes inside a network dataset. Default ArcGIS Online Travel Modes are: "Driving Distance", "Rural Driving Distance", "Driving Time", "Rural Driving Time", "Trucking Distance", "Trucking Time", "Walking Distance", and "Walking Time". |
< > restrictionAttributeNames |
Required | The restriction attributes to respect during analysis. A list of possible restrictions of the ArcGIS Online services is listed here. NOTE: Attribute names are specific to the network dataset. They may be different if using another Network Analysis service besides the one hosted via ArcGIS Online. |
< > simplicationToleranceUnits |
Required | Possible values are: "esriFeet", "esriKilometers", "esriMeters", "esriMiles", "esriNauticalMiles", and "esriYards". |
< > simplificationTolerance |
Required | How much to generalize the output geometry. |
< > timeAttributeName |
Required | The time-based cost attribute for reporting directions,for example "Minutes", "Travel Time", "TimeAt1KPH", "WalkTime", and "TruckTravelTime". NOTE: Attribute names are specific to the network dataset. They may be different if using another Network Analysis service besides the one hosted via ArcGIS Online. |
< > type |
Required | The travel mode type. Possible values are: "AUTOMOBILE", "TRUCK", "WALK", or "OTHER". |
< > useHierarchy |
Required | Indicates whether or not to use a hierarchical road classification for faster analysis. |
< > uturnAtJunctions |
Required | Specify where u-turns are allowed. Possible values are: "esriNFSBAllowBacktrack", "esriNFSBAtDeadEndsOnly", "esriNFSBNoBacktrack", and "esriNFSBAtDeadEndsAndIntersections". |
Boolean
> useHierarchytrue | false
Boolean
> useTimeWindowsA 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 also that the stops will be visited in the order they were added unless you set RouteParameters.findBestSequence
to true.
true | false