Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: ClosestFacilityParameters

require(["esri/tasks/ClosestFacilityParameters"], function(ClosestFacilityParameters) { /* code goes here */ });

Description

(Added at v2.0)
Input parameters for the ClosestFacilityTask.

Note: ClosestFacilityParameters and other closest facility related classes require ArcGIS Server 10.0 or greater and a closest facility layer. A closest facility layer is a layer of type esriNAServerClosestFacilityLayer.

Samples

Search for samples that use this class.

Constructors

NameSummary
new ClosestFacilityParameters()Creates a new ClosestFacilityParameters object.

Properties

NameTypeSummary
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.
defaultCutoffNumberThe cutoff value used to determine when to stop traversing.
defaultTargetFacilityCountNumberThe number of facilities to find.
directionsLanguageStringThe language used when computing directions.
directionsLengthUnitsStringThe length units used when computing directions.
directionsOutputTypeStringDefines the amount of direction information returned.
directionsStyleNameStringThe style to be used when returning directions.
directionsTimeAttributeStringThe name of the attribute field that contains the drive time values.
doNotLocateOnRestrictedElementsBooleanWhen true, restricted network elements should be considered when finding network locations.
facilitiesObjectThe set of facilities loaded as network locations during analysis.
impedanceAttributeStringThe network attribute field name used as the impedance attribute during analysis.
incidentsObjectThe set of incidents loaded as network locations during analysis.
outSpatialReferenceSpatialReferenceThe well-known id of the spatial reference for the geometries returned with the analysis results.
outputGeometryPrecisionNumberThe output geometry precision.
outputGeometryPrecisionUnitsStringThe units of the output geometry precision.
outputLinesStringThe type of output lines to be generated in the result.
pointBarriersObjectThe set of point barriers loaded as network locations during analysis.
polygonBarriersObjectThe set of polygon barriers loaded as network locations during analysis.
polylineBarriersObjectThe set of polyline barriers loaded as network locations during analysis.
restrictUTurnsStringSpecifies how U-Turns should be handled.
restrictionAttributesString[]The list of network attribute names to be used as restrictions with the analysis.
returnDirectionsBooleanIf true, directions will be generated and returned in the directions property of each RouteResult and RouteSolveResult.
returnFacilitiesBooleanIf true, facilities will be returned with the analysis results.
returnIncidentsBooleanIf true, incidents will be returned with the analysis results.
returnPointBarriersBooleanIf true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult.
returnPolygonBarriersBooleanIf true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult.
returnPolylineBarriersBooleanIf true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult.
returnRoutesBooleanWhen true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult.
timeOfDayDateThe arrival or departure date and time.
timeOfDayUsageStringDefines the way the timeOfDay value is used.
travelDirectionStringOptions for traveling to or from the facility.
travelModeObjectTravel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network.
useHierarchyBooleanIf true, the hierarchy attribute for the network will be used in analysis.
Constructor Details

new ClosestFacilityParameters()

Creates a new ClosestFacilityParameters object
Sample:
 
require([
  "esri/tasks/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var params = new ClosestFacilityParameters();
  params.defaultCutoff = 3.0;
  params.returnIncidents = false;
  params.returnRoutes = true;
  params.returnDirections = true;
  ...
});
Property Details

<String[]> accumulateAttributes

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

<Object[]> attributeParameterValues

An array of attribute parameter values that determine which network elements can be used by a vehicle. Each object has the following properties:
<String>attributeName The name of the attribute.
<String>parameterName The parameter name.
<String>value The parameter value.
Object Specifications:
<attributeParameterValues>
<String> attributeName Required Name of the attribute, for example, attributeName:"Avoid paved roads".
<String> parameterName Required Name of the parameter, for example, parameterValue:"Restriction usage".
<String> value Required The string value, for example, value:"AVOID_HIGH".

<Number> defaultCutoff

The cutoff value used to determine when to stop traversing.

<Number> defaultTargetFacilityCount

The number of facilities to find.

<String> directionsLanguage

The language used when computing directions. If not specified the task will use the language defined in the network layer used by the RouteTask. The default language defined by the NAServer is en_US, the server administrator is responsible for adding additional languages.

<String> directionsLengthUnits

The length units used when computing directions. If not specified the task will use the value defined by the routing network layer is used. Possible values are "esriFeet", "esriKilometers","esriMeters", "esriMiles","esriNauticalMiles" and "esriYards".

<String> directionsOutputType

Defines the amount of direction information returned. The default value is standard.  (Added at v3.3)
Known values: complete | complete-no-events | instructions-only | standard | summary-only

<String> directionsStyleName

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. (Added at v3.3)

<String> directionsTimeAttribute

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.

<Boolean> doNotLocateOnRestrictedElements

When true, restricted network elements should be considered when finding network locations. The default value is false. (Added at v3.0)
Known values: true | false

<Object> facilities

The set of facilities loaded as network locations during analysis. These can be specified as either esri.tasks.DataLayer or esri.tasks.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 Note that either the features or url  property should be specified. 
Sample:
require([
  "esri/layers/GraphicsLayer", "esri/tasks/FeatureSet", "esri/tasks/DataFile", ... 
], function(GraphicsLayer, FeatureSet, DataFile, ... ) {
  var facilitiesGraphicsLayer = new GraphicsLayer();

  //Specify facilities using a FeatureSet
  var facilities = new FeatureSet();
  facilities.features = facilitiesGraphicsLayer.graphics;

  //Requires ArcGIS Server 10.1 or greater
  var networkServiceUrl = 'http://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"
  });
  ...
});

<String> impedanceAttribute

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.

<Object> incidents

The set of incidents loaded as network locations during analysis. Can be an instance of esri.tasks.DataLayer or esri.tasks.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 Note that either the features or url property should be specified. 
Sample:
//specify incidents using a FeatureSet
var location = new esri.Graphic(inPoint);
incidentsGraphicsLayer.add(location);

var features = [];
features.push(location);
var incidents = new esri.tasks.FeatureSet();
incidents.features = features;
params.incidents = incidents;
//Requires ArcGIS Server 10.1 or greater 
var networkServiceUrl = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/';
params.incidents = new esri.tasks.DataFile({
  url: networkServiceUrl + "4/query?where=1%3D1&returnGeometry=true&outFields=*&f=json"
});

<SpatialReference> outSpatialReference

The well-known id of the spatial reference for the geometries returned with the analysis results. If the outSpatialReference is not specified, the geometries are returned in the spatial reference of the map.

<Number> outputGeometryPrecision

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

<String> outputGeometryPrecisionUnits

The units of the output geometry precision. The default value is esriUnknownUnits

<String> outputLines

The type of output lines to be generated in the result. The default is as defined in the specific routing network layer used in your RouteTask. See NAOutputLine for a list of valid values.

<Object> pointBarriers

The set of point barriers loaded as network locations during analysis. Can be an instance of esri.tasks.DataLayer or esri.tasks.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 Note that either the features or url property should be specified. 

<Object> polygonBarriers

The set of polygon barriers loaded as network locations during analysis. Can be an instance of esri.tasks.DataLayer or esri.tasks.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 Note that either the features or url property should be specified. 

<Object> polylineBarriers

The set of polyline barriers loaded as network locations during analysis. Can be an instance of esri.tasks.DataLayer or esri.tasks.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 Note that either the features or url property should be specified. 

<String> restrictUTurns

Specifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your RouteTask. See NAUTurn for a list of valid values.

<String[]> restrictionAttributes

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.
Sample: Specify restriction attributes
require([
  "esri/dijit/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var closestFacilityParams = new ClosestFacilityParameters();
  closestFacilityParams.restrictionAttributes = ["OneWay"];
  ...
});
Override the service defaults and specify that no restrictions should be used.
require([
  "esri/dijit/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var closestFacilityParams = new ClosestFacilityParameters();
  closestFacilityParams.restrictionAttributes = ["none"];
  ...
});

<Boolean> returnDirections

If true, directions will be generated and returned in the directions property of each RouteResult and RouteSolveResult. Default value is false.
Known values: true | false
Default value: false
Sample:
require([
  "esri/tasks/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var params = new esri.tasks.ClosestFacilityParameters();
  params.returnDirections = true;
  ...
});

<Boolean> returnFacilities

If true, facilities will be returned with the analysis results.
Known values: true | false
Default value: false

<Boolean> returnIncidents

If true, incidents will be returned with the analysis results.
Known values: true | false
Default value: false

<Boolean> returnPointBarriers

If true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false.
Known values: true | false
Default value: false

<Boolean> returnPolygonBarriers

If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult.
Known values: true | false
Default value: false

<Boolean> returnPolylineBarriers

If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult.
Known values: true | false
Default value: false

<Boolean> returnRoutes

When true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. Default value is true.
Known values: true | false

<Date> timeOfDay

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. (Added at v2.6)
Sample:
require([
  "esri/tasks/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var params = new ClosestFacilityParameters();
  params.timeOfDay = new Date();
  ...
});

<String> timeOfDayUsage

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. (Added at v2.6)
Known values: start | end
Sample:
require([
  "esri/tasks/ClosestFacilityParameters", ... 
], function(ClosestFacilityParameters, ... ) {
  var params = new ClosestFacilityParameters();
  params.timeOfDayUsage = "start";
  ...
});

<String> travelDirection

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

<Object> travelMode

Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. This can take values from the supportedTravelModes array returned by the ClosestFacilityTask'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. More information regarding working with travel modes can be found here. (Added at v3.14)
Default value: Null
Object Specifications:
<travelMode>
<Object[]> 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.
<String> description Required A description of the travel mode used.
<String> distanceAttributeName Required The distance-based cost attribute for reporting directions and determining distance based costs when solving vehicle routing problems, for example, "Miles".

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.
<String> id Required Unique identifier for the travel mode.
<String> impedanceAttributeName Required The cost attribute on which to optimize the analysis, for example, "Miles", "Minutes", "Travel Time", "Kilometers", "TimeAt1KPH", "WalkTime", and "TruckTravelTime".The distance-based cost attribute for reporting directions and determining distance based costs when solving vehicle routing problems, for example, "Miles".

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.
<String> 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".
<String[]> 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.
<String> simplicationToleranceUnits Required Possible values are: "esriFeet", "esriKilometers", "esriMeters", "esriMiles", "esriNauticalMiles", and "esriYards".
<Number> simplificationTolerance Required How much to generalize the output geometry.
<String> 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.
<String> type Required The travel mode type. Possible values are: "AUTOMOBILE", "TRUCK", "WALK", or "OTHER".
<Boolean> useHierarchy Required Indicates whether or not to use a hierarchical road classification for faster analysis.
<String> uturnAtJunctions Required Specify where u-turns are allowed. Possible values are: "esriNFSBAllowBacktrack", "esriNFSBAtDeadEndsOnly", "esriNFSBNoBacktrack", and "esriNFSBAtDeadEndsAndIntersections".

<Boolean> useHierarchy

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.
Known values: true | false
Show Modal