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 require 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.
NameTypeSummary
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
Object[]

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

more details
more details
String

The name of the class.

more details
more details
Number

The cutoff value used to determine when to stop traversing.

more details
more details
Number

The number of facilities to find.

more details
more details
String

The language used when generating driving directions.

more details
more details
String

The length units used when computing driving directions.

more details
more details
String

Defines the amount of direction information returned.

more details
more details
String

The style to be used when returning directions.

more details
more details
String

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

more details
more details
Boolean

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

more details
more details
DataLayer | FeatureSet

The set of facilities loaded as network locations during analysis.

more details
more details
String

The network attribute field name used as the impedance attribute during analysis.

more details
more details
DataLayer | FeatureSet

The set of incidents loaded as network locations during analysis.

more details
more details
Number

The output geometry precision.

more details
more details
String

The units of the output geometry precision.

more details
more details
String

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

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

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

more details
more details
DataLayer | FeatureSet

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

more details
more details
DataLayer | FeatureSet

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

more details
more details
String[]

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

more details
more details
String

Specifies how U-Turns should be handled.

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Boolean

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

more details
more details
Date

The arrival or departure date and time.

more details
more details
String

Defines the way the timeOfDay value is used.

more details
more details
String

Options for traveling to or from the facility.

more details
more details
Boolean

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

more details
more details

Property Details

accumulateAttributesString[]

The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response.

attributeParameterValuesObject[]

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.

declaredClassStringreadonly

The name of the class. The declared class name is formatted as esri.folder.className.

defaultCutoffNumber

The cutoff value used to determine when to stop traversing.

defaultTargetFacilityCountNumber

The number of facilities to find.

directionsLanguageString

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.

directionsLengthUnitsString

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.

Known Values: centimeters | decimal-degrees | decimeters | feet | inches | kilometers | meters | miles | millimeters | nautical-miles | points | yards

directionsOutputTypeString

Defines the amount of direction information returned. The default value is standard.

Known Values: complete | complete-no-events | instructions-only | standard | summary-only

directionsStyleNameString

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.

directionsTimeAttributeString

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.

doNotLocateOnRestrictedElementsBoolean

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"
  });
  ...
});

impedanceAttributeString

The network attribute field name used as the impedance attribute during analysis. If not specified the default value defined by the routing network layer.

Valid values include any attribute name listed in the Service Directory under Network Dataset > Network Attributes with a Usage Type of esriNauTCost. Specify none to indicate that no network attributes should be used for impedance. If you specify an empty string the default value defined by the service will be used. See the Understanding the network attribute 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.

outputGeometryPrecisionNumber

The output geometry precision. When 0, no generalization of the output geometry is performed. Positive values represent the MaximumAllowableOffset parameter used by generalize.

outputGeometryPrecisionUnitsString

The units of the output geometry precision.

Known Values: centimeters | decimal-degrees | decimeters | feet | inches | kilometers | meters | miles | millimeters | nautical-miles | points | yards

outputLinesString

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. See NAOutputLine for a list of valid values.

outSpatialReferenceSpatialReference|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.

pointBarriersDataLayer|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.

polygonBarriersDataLayer|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.

polylineBarriersDataLayer|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.

restrictionAttributesString[]

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.

restrictUTurnsString

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".

Known Values: allow-backtrack | at-dead-ends-only | no-backtrack | at-dead-ends-and-intersections

returnDirectionsBoolean

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

Default Value: false

returnFacilitiesBoolean

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

Default Value: false

returnIncidentsBoolean

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

Default Value: false

returnPointBarriersBoolean

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

Default Value: false

returnPolygonBarriersBoolean

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

Default Value: false

returnPolylineBarriersBoolean

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

Default Value: false

returnRoutesBoolean

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

Default Value: true

timeOfDayDate

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.

timeOfDayUsageString

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.

Known Values: start | end

travelDirectionString

Options for traveling to or from the facility. Default values are defined by the newtork layer. See NATravelDirection for a list of valid values.

useHierarchyBoolean

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

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

more details
more details

Method Details

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

There were no match results from your search criteria.