Input parameters for closestFacility.
ClosestFacilityParameters, and other closest facility related classes, requires a closest facility layer.
A closest facility layer is a layer of type esriNAServerClosestFacilityLayer
.
- See also:
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/rest/support/ClosestFacilityParameters", "esri/rest/closestFacility", ... ], function(ClosestFacilityParameters, closestFacility, ... ) { const params = new ClosestFacilityParameters({ defaultCutoff: 3.0, returnIncidents: false, returnRoutes: true, returnDirections: true }); closestFacility.solve(url, params).then(function(solveResult) { console.log(solveResult); }); });
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String[] | more 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. | more details | ClosestFacilityParameters | |
String | more details An authorization string used to access a resource or service. | more details | ClosestFacilityParameters | |
Object[] | more details An array of attribute parameter values that determine which network elements can be used by a vehicle. | more details | ClosestFacilityParameters | |
String | more details The name of the class. | more details | Accessor | |
Number | more details The cutoff value used to determine when to stop traversing. | more details | ClosestFacilityParameters | |
Number | more details The number of facilities to find. | more details | ClosestFacilityParameters | |
String | more details The language used when generating driving directions. | more details | ClosestFacilityParameters | |
String | more details The length units used when computing driving directions. | more details | ClosestFacilityParameters | |
String | more details Defines the amount of direction information returned. | more details | ClosestFacilityParameters | |
String | more details The style to be used when returning directions. | more details | ClosestFacilityParameters | |
String | more details The name of the attribute field that contains the drive time values. | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl | more details The set of facilities loaded as network locations during analysis. | more details | ClosestFacilityParameters | |
String | more details The network attribute name used as the impedance attribute in analysis. | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl | more details The set of incidents loaded as network locations during analysis. | more details | ClosestFacilityParameters | |
Number | more details The output geometry precision. | more details | ClosestFacilityParameters | |
String | more details The units of the output geometry precision. | more details | ClosestFacilityParameters | |
String | more details The type of output lines to be generated in the result. | more details | ClosestFacilityParameters | |
SpatialReference|String | more details The well-known id of the spatial reference or the spatial reference object for the geometries returned with the analysis results. | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl | more details The set of point barriers loaded as network locations during analysis. | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl | more details The set of polygon barriers loaded as network locations during analysis. | more details | ClosestFacilityParameters | |
DataLayer|FeatureSet|NetworkFeatureSet|NetworkUrl | more details The set of polyline barriers loaded as network locations during analysis. | more details | ClosestFacilityParameters | |
String[] | more details The list of network attribute names to be used as restrictions with the analysis. | more details | ClosestFacilityParameters | |
String | more details Specifies how U-Turns should be handled. | more details | ClosestFacilityParameters | |
Boolean | more details Indicates whether the service should generate driving directions for each route. | more details | ClosestFacilityParameters | |
Boolean | more details If | more details | ClosestFacilityParameters | |
Boolean | more details If | more details | ClosestFacilityParameters | |
Boolean | more details If | more details | ClosestFacilityParameters | |
Boolean | more details If | more details | ClosestFacilityParameters | |
Boolean | more details If | more details | ClosestFacilityParameters | |
Boolean | more details When | more details | ClosestFacilityParameters | |
Date | more details The arrival or departure date and time. | more details | ClosestFacilityParameters | |
String | more details Defines the way the | more details | ClosestFacilityParameters | |
String | more details Options for traveling to or from the facility. | more details | ClosestFacilityParameters | |
TravelMode | more details A travel mode represents a means of transportation, such as driving or walking. | more details | ClosestFacilityParameters | |
Boolean | more details 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.
-
apiKey StringSince: ArcGIS API for JavaScript 4.21
-
An authorization string used to access a resource or service. API keys are generated and managed in the ArcGIS Developer dashboard. An API key is tied explicitly to an ArcGIS account; it is also used to monitor service usage. Setting a fine-grained API key on a specific class overrides the global API key.
Example:const start = new Graphic({ geometry: { type: "point", x: -13656212.041436872, y: 5703897.952531632, spatialReference } }); const stores = [ [-122.67484, 45.52087], [-122.68365, 45.52327], [-122.66406, 45.52378] ]; const storeGraphics = stores.map( (store) => new Graphic({ geometry: { type: "point", longitude: store[0], latitude: store[1], spatialReference } }) ); const closestFacilityParameters = new ClosestFacilityParameters({ apiKey: "YOUR_API_KEY", incidents: new FeatureSet({ features: [start] }), facilities: new FeatureSet({ features: storeGraphics }), defaultTargetFacilityCount: 2 }); const results = await solve(url, closestFacilityParameters);
-
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.
-
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.
-
-
The set of facilities loaded as network locations during analysis.
Example:require([ "esri/layers/GraphicsLayer", "esri/rest/support/FeatureSet", "esri/rest/support/NetworkUrl", ... ], function(GraphicsLayer, FeatureSet, NetworkUrl, ... ) { const facilitiesGraphicsLayer = new GraphicsLayer(); // Specify facilities using a FeatureSet const facilities = new FeatureSet({ features: facilitiesGraphicsLayer.graphics.toArray() }); params.facilities = new NetworkUrl({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/MapServer/" + "14/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 route. 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.
-
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.
-
-
The set of polygon barriers loaded as network locations during analysis.
-
-
The set of polyline barriers loaded as network locations during analysis.
-
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/rest/closestFacility".
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.
-
timeOfDayUsage String
-
Defines the way the
timeOfDay
value is used. The default value is defined in the network layer.Possible Values:"start"|"end"
-
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 TravelMode
-
A travel mode represents a means of transportation, such as driving or walking. Travel modes define the physical characteristics of a vehicle or pedestrian.
The value for the
travelMode
parameter is the JSON object containing the settings for a travel mode supported by your service. To get the supported travel modes, execute theretrieveTravelModes
operation. You can make a request to retrieve travel modes using the following form:https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/retrieveTravelModes?f=json
-
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 closestFacility.- Default Value:false
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
* | more details Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | more details | ClosestFacilityParameters | |
more details Adds one or more handles which are to be tied to the lifecycle of the object. | more details | Accessor | ||
Object | more details Converts an instance of this class to its ArcGIS portal JSON representation. | 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 an ArcGIS product. 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.
-
own(handleOrHandles)inheritedSince: ArcGIS API for JavaScript 4.24
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.whenOnce(() => !view.updating) .then(() => { wkidSelect.disabled = false; }); handle.remove(); // Assign a handle using own() this.own(reactiveUtils.whenOnce(() => !view.updating) .then(() => { wkidSelect.disabled = false; }));
Parameter:handleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
-
toJSON(){Object}
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
Returns:Type Description Object The ArcGIS portal JSON representation of an instance of this class.