Skip To ContentArcGIS for DevelopersSign In Dashboard

ClosestFacilityParameters

require(["esri/tasks/support/ClosestFacilityParameters"], function(ClosestFacilityParameters) { /* code goes here */ });
Class: esri/tasks/support/ClosestFacilityParameters
Inheritance: ClosestFacilityParameters Accessor
Since: ArcGIS API for JavaScript 4.0

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.

See also:

Constructors

new ClosestFacilityParameters(properties)
Parameter:
properties Object
optional

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

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
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 detailsClosestFacilityParameters
Object[]

An array of attribute parameter values that determine which network elements can be used by a vehicle.

more details
more detailsClosestFacilityParameters
String

The name of the class.

more details
more detailsAccessor
Number

The cutoff value used to determine when to stop traversing.

more details
more detailsClosestFacilityParameters
Number

The number of facilities to find.

more details
more detailsClosestFacilityParameters
String

The language used when generating driving directions.

more details
more detailsClosestFacilityParameters
String

The length units used when computing driving directions.

more details
more detailsClosestFacilityParameters
String

Defines the amount of direction information returned.

more details
more detailsClosestFacilityParameters
String

The style to be used when returning directions.

more details
more detailsClosestFacilityParameters
String

The name of the attribute field that contains the drive time values.

more details
more detailsClosestFacilityParameters
Boolean

When true, restricted network elements should be considered when finding network locations.

more details
more detailsClosestFacilityParameters
DataLayer|FeatureSet

The set of facilities loaded as network locations during analysis.

more details
more detailsClosestFacilityParameters
String

The network attribute name used as the impedance attribute in analysis.

more details
more detailsClosestFacilityParameters
DataLayer|FeatureSet

The set of incidents loaded as network locations during analysis.

more details
more detailsClosestFacilityParameters
Number

The output geometry precision.

more details
more detailsClosestFacilityParameters
String

The units of the output geometry precision.

more details
more detailsClosestFacilityParameters
String

The type of output lines to be generated in the result.

more details
more detailsClosestFacilityParameters
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 detailsClosestFacilityParameters
DataLayer|FeatureSet

The set of point barriers loaded as network locations during analysis.

more details
more detailsClosestFacilityParameters
DataLayer|FeatureSet

The set of polygon barriers loaded as network locations during analysis.

more details
more detailsClosestFacilityParameters
DataLayer|FeatureSet

The set of polyline barriers loaded as network locations during analysis.

more details
more detailsClosestFacilityParameters
String[]

The list of network attribute names to be used as restrictions with the analysis.

more details
more detailsClosestFacilityParameters
String

Specifies how U-Turns should be handled.

more details
more detailsClosestFacilityParameters
Boolean

Indicates whether the service should generate driving directions for each route.

more details
more detailsClosestFacilityParameters
Boolean

If true, facilities will be returned with the analysis results.

more details
more detailsClosestFacilityParameters
Boolean

If true, incidents will be returned with the analysis results.

more details
more detailsClosestFacilityParameters
Boolean

If true, point barriers will be returned in the barriers property of the ClosestFacilitySolveResult.

more details
more detailsClosestFacilityParameters
Boolean

If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult.

more details
more detailsClosestFacilityParameters
Boolean

If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult.

more details
more detailsClosestFacilityParameters
Boolean

When true, closest facility routes will be generated and returned in the route property of each ClosestFacilitySolveResult.

more details
more detailsClosestFacilityParameters
Date

The arrival or departure date and time.

more details
more detailsClosestFacilityParameters
String

Defines the way the timeOfDay value is used.

more details
more detailsClosestFacilityParameters
String

Options for traveling to or from the facility.

more details
more detailsClosestFacilityParameters
String

Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.

more details
more detailsClosestFacilityParameters
Boolean

If true, the hierarchy attribute for the network will be used in analysis.

more details
more detailsClosestFacilityParameters

Property Details

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[]

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.

Properties:
attributeName String

The name of the attribute.

parameterName String

The parameter name.

value String

The parameter value.

declaredClass Stringreadonly inherited
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.

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 as Usage Type: esriNAUTCost. You can also specify a value of none 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 and impedanceAttribute = '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 the MaximumAllowableOffset 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 ValueDescription
noneNo lines are returned
straightOnly returns straight lines
true-shapeReturn the true shape of the lines
true-shape-with-measureReturn the true shape of the lines with their measurements
outSpatialReference SpatialReference|String

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.

pointBarriers DataLayer|FeatureSet

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.

polygonBarriers DataLayer|FeatureSet

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.

polylineBarriers DataLayer|FeatureSet

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.

restrictionAttributes String[]

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.

timeOfDay Date

The arrival or departure date and time. For example, if the travelDirection is set to to-facility and timeOfDayUsage is set to end and timeOfDay 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.

Possible Values: start | end

travelDirection String

Options for traveling to or from the facility. Default values are defined by the network layer.

Possible ValueDescription
from-facilitySets travel direction from the facility
to-facilitySets travel direction to the facility
travelMode String

Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.

See also:
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

NameReturn TypeSummaryClass
*

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 detailsClosestFacilityParameters
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsClosestFacilityParameters

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 Object

A 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:
TypeDescription
*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:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule
Loading...