ClosestFacilityParameters
require(["esri/tasks/support/ClosestFacilityParameters"], function(ClosestFacilityParameters) { /* code goes here */ });
esri/tasks/support/ClosestFacilityParameters
Input parameters for ClosestFacilityTask.
ClosestFacilityParameters, and other closest facility related classes, requires a closest facility layer. A closest facility layer is a layer of type esriNAServerClosestFacilityLayer
.
Constructors
- new ClosestFacilityParameters(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Example:require([ "esri/tasks/support/ClosestFacilityParameters", "esri/tasks/ClosestFacilityTask", ... ], function(ClosestFacilityParameters, ClosestFacilityTask, ... ) { var closestFacilityTask = new ClosestFacilityTask( ... ); // Add task url here var params = new ClosestFacilityParameters({ defaultCutoff: 3.0, returnIncidents: false, returnRoutes: true, returnDirections: true }); closestFacilityTask.solve(params).then(function(solveResult){ // solveResult contains the result of the task }); });
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
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. more details | more details | ClosestFacilityParameters | |
Object[] | An array of attribute parameter values that determine which network elements can be used by a vehicle. more details | more details | ClosestFacilityParameters | |
String | The name of the class. more details | more details | Accessor | |
Number | The cutoff value used to determine when to stop traversing. more details | more details | ClosestFacilityParameters | |
Number | The number of facilities to find. more details | more details | ClosestFacilityParameters | |
String | The language used when generating driving directions. more details | more details | ClosestFacilityParameters | |
String | The length units used when computing driving directions. more details | more details | ClosestFacilityParameters | |
String | Defines the amount of direction information returned. more details | more details | ClosestFacilityParameters | |
String | The style to be used when returning directions. more details | more details | ClosestFacilityParameters | |
String | The name of the attribute field that contains the drive time values. more details | more details | ClosestFacilityParameters | |
Boolean | When | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet | The set of facilities loaded as network locations during analysis. more details | more details | ClosestFacilityParameters | |
String | The network attribute name used as the impedance attribute in analysis. more details | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet | The set of incidents loaded as network locations during analysis. more details | more details | ClosestFacilityParameters | |
Number | The output geometry precision. more details | more details | ClosestFacilityParameters | |
String | The units of the output geometry precision. more details | more details | ClosestFacilityParameters | |
String | The type of output lines to be generated in the result. more details | more details | ClosestFacilityParameters | |
SpatialReference|String | The well-known id of the spatial reference or the spatial reference object for the geometries returned with the analysis results. more details | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet | The set of point barriers loaded as network locations during analysis. more details | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet | The set of polygon barriers loaded as network locations during analysis. more details | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet | The set of polyline barriers loaded as network locations during analysis. more details | more details | ClosestFacilityParameters | |
String[] | The list of network attribute names to be used as restrictions with the analysis. more details | more details | ClosestFacilityParameters | |
String | Specifies how U-Turns should be handled. more details | more details | ClosestFacilityParameters | |
Boolean | Indicates whether the service should generate driving directions for each route. more details | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters | |
Boolean | When | more details | ClosestFacilityParameters | |
Date | The arrival or departure date and time. more details | more details | ClosestFacilityParameters | |
String | Defines the way the | more details | ClosestFacilityParameters | |
String | Options for traveling to or from the facility. more details | more details | ClosestFacilityParameters | |
String | Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. more details | more details | ClosestFacilityParameters | |
Boolean | If | more details | ClosestFacilityParameters |
Property Details
The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response.
An array of attribute parameter values that determine which network elements can be used by a vehicle. View the object specifications below for properties of the individual objects in this array.
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
- defaultCutoff Number
The cutoff value used to determine when to stop traversing.
- defaultTargetFacilityCount Number
The number of facilities to find.
- directionsLanguage String
The language used when generating driving directions. This parameter applies only when returnDirections parameter is set to
true
. If an unsupported language code is specified, the service returns the directions using the default language, English.
- directionsLengthUnits String
The length units used when computing driving directions. This parameter applies only when returnDirections parameter is set to
true
. If not specified the task will use the value defined by the routing network layer is used.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. The default value is standard.
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 the attribute field that contains the drive time values. If not specified, the task will use the attribute field defined by the routing network layer.
- doNotLocateOnRestrictedElements Boolean
When
true
, restricted network elements should be considered when finding network locations.- Default Value:true
The set of facilities loaded as network locations during analysis. These can be specified as either a DataLayer or a FeatureSet.
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. Either the features or url property should be specified.Example:require([ "esri/layers/GraphicsLayer", "esri/tasks/support/FeatureSet", "esri/tasks/support/DataFile", ... ], function(GraphicsLayer, FeatureSet, DataFile, ... ) { var facilitiesGraphicsLayer = new GraphicsLayer(); // Specify facilities using a FeatureSet var facilities = new FeatureSet(); facilities.features = facilitiesGraphicsLayer.graphics.toArray(); // Requires ArcGIS Server 10.1 or greater var networkServiceUrl = 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/'; params.facilities = new DataFile({ url: networkServiceUrl + "3/query?where=1%3D1&returnGeometry=true&outFields=*&f=json" }); ... });
- impedanceAttribute String
The network attribute name used as the impedance attribute in analysis. The default is as defined in the 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 string, it will use the default of the service.For example, set
impedanceAttribute = 'Time'
for quickest route andimpedanceAttribute = 'Length'
for shortest drive, assuming the service has those two esriNAUTCost attributes.View the Understanding the network attribute ArcGIS desktop help topic for more details.
The set of incidents loaded as network locations during analysis. Can be an instance of DataLayer or FeatureSet. 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. Either the features or url property should be specified.
- outputGeometryPrecision Number
The output geometry precision. When
0
, no generalization of the output geometry is performed. Positive values represent theMaximumAllowableOffset
parameter used by 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 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 or the spatial reference object for the geometries returned with the analysis results. If
outSpatialReference
is not specified, the geometries are returned in the spatial reference of the map.
The set of point barriers loaded as network locations during analysis. Can be an instance of DataLayer or FeatureSet. 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. Either the features or url property should be specified.
The set of polygon barriers loaded as network locations during analysis. Can be an instance of DataLayer or FeatureSet. 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. Either the features or url property should be specified.
The set of polyline barriers loaded as network locations during analysis. Can be an instance of DataLayer or FeatureSet. 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. Either the features or url property should be specified.
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. Use
["none"]
to override the service defaults and specify that no restrictions should be used.
- restrictUTurns String
Specifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your module:"esri/tasks/ClosestFacilityTask".
Possible Values:"allow-backtrack"|"at-dead-ends-only"|"no-backtrack"|"at-dead-ends-and-intersections"
- returnDirections Boolean
Indicates whether the service should generate driving directions for each route.
- Default Value:false
- returnFacilities Boolean
If
true
, facilities will be returned with the analysis results.- Default Value:false
- returnIncidents Boolean
If
true
, incidents will be returned with the analysis results.- Default Value:false
- returnPointBarriers Boolean
If
true
, point barriers will be returned in the barriers property of the ClosestFacilitySolveResult.- Default Value:false
- returnPolygonBarriers Boolean
If
true
, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult.- Default Value:false
- returnPolylineBarriers Boolean
If
true
, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult.- Default Value:false
- returnRoutes Boolean
When
true
, closest facility routes will be generated and returned in the route property of each ClosestFacilitySolveResult.- Default Value:true
- timeOfDay Date
The arrival or departure date and time. For example, if the travelDirection is set to
to-facility
andtimeOfDayUsage
is set toend
andtimeOfDay
is set to 8:00 a.m., the returned route(s) will be setup to arrive at the facility at 8:00 a.m. local time. Requires ArcGIS Server service version 10.1 or greater.
- timeOfDayUsage String
Defines the way the
timeOfDay
value is used. The default value is defined in the network layer. Requires ArcGIS Server service version 10.1 or greater.
- travelDirection String
Options for traveling to or from the facility. Default values are defined by the network layer.
Possible Value Description from-facility Sets travel direction from the facility to-facility Sets travel direction to the facility Possible Values:"from-facility"|"to-facility"
- travelMode String
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 will be used in analysis. The default is defined in the routing network layer used by the ClosestFacilityTask.- 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 | ClosestFacilityParameters | |
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | ClosestFacilityParameters |
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.