Hide Table of Contents
esri
Map
toolbars
Class: ClosestFacilityParameters
[ AMD Module Require | Legacy Module Require ]

Description

Class added 2.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.

Class hierarchy

esri.tasks.ClosestFacilityParameters

Constructors

ConstructorDescription
new esri.tasks.ClosestFacilityParameters()Creates a new ClosestFacilityParameters object

Properties

PropertyTypeDescription
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.
defaultTargetFacilityCountintThe number of facilities to find.
directionsLanguageStringThe language used when computing directions. By default the task will use the language defined in the network layer used by the RouteTask.
directionsLengthUnitsStringThe length units used when computing directions. By default the value defined by the routing network layer is used.
directionsOutputTypeStringDefines the amount of direction information returned. The default value is standard. 
directionsStyleNameStringThe 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. 
directionsTimeAttributeStringThe 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.
doNotLocateOnRestrictedElementsBooleanWhen true, restricted network elements should be considered when finding network locations. The default value is false.
facilitiesObjectThe set of facilities loaded as network locations during analysis.
impedenceAttributeStringThe 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. If the outSpatialReference is not specified, the geometries are returned in the spatial reference of the map.
outputGeometryPrecisionNumberThe output geometry precision.
outputGeometryPrecisionUnitsStringThe units of the output geometry precision. The default value is esriUnknownUnits
outputLinesStringThe type of output lines generated in the result.
pointBarriersObjectThe 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. 
polygonBarriersObjectThe 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. 
polylineBarriersObjectThe 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. 
restrictUTurnsStringSpecifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your RouteTask.
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. Default value is false.
returnFacilitiesBooleanIf true, facilities will be returned with the analysis results. Default values is false.
returnIncidentsBooleanIf true, incidents will be returned with the analysis results. Default value is false.
returnPointBarriersBooleanIf true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false.
returnPolygonBarriersBooleanIf true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false.
returnPolylineBarriersBooleanIf true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false.
returnRoutesBooleanWhen true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. Default value is true.
timeOfDayDateThe arrival or departure date and time.
timeOfDayUsageStringDefines the way the timeOfDay value is used.
travelDirectionStringOptions for traveling to or from the facility. Default values are defined by the newtork layer. See NATravelDirection for a list of valid values.
useHierarchyBooleanIf 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.
Constructor Details

new esri.tasks.ClosestFacilityParameters()

Creates a new ClosestFacilityParameters object
Code Snippet:
 
var params = new esri.tasks.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.

<Number> defaultCutoff

The cutoff value used to determine when to stop traversing.

<int> 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)

<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. 
Code Snippet:
//Specify facilities using a FeatureSet
var facilities = new esri.tasks.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 esri.tasks.DataFile({
  url: networkServiceUrl + "3/query?where=1%3D1&returnGeometry=true&outFields=*&f=json"
});

<String> impedenceAttribute

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. 
Code Snippet:
//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.
Code Snippet:
Specify restriction attributes
closestFacilityParams.restrictionAttributes = ["OneWay"];
Override the service defaults and specify that no restrictions should be used.
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.
Code Snippet:
var params = new esri.tasks.ClosestFacilityParameters();
params.returnDirections = true;

<Boolean> returnFacilities

If true, facilities will be returned with the analysis results. Default values is false.

<Boolean> returnIncidents

If true, incidents will be returned with the analysis results. Default value is false.

<Boolean> returnPointBarriers

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

<Boolean> returnPolygonBarriers

If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false.

<Boolean> returnPolylineBarriers

If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is 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.

<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)
Code Snippet:
var params = new esri.tasks.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
Code Snippet:
var params = new esri.tasks.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.

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