Hide Table of Contents
esri
arcgis
dijit
geometry
layers
renderer
symbols
tasks
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.
esri.tasks.ClosestFacilityParameters
| Constructor | Description |
|---|---|
| new esri.tasks.ClosestFacilityParameters() | Creates a new ClosestFacilityParameters object |
| Property | Type | Description |
|---|---|---|
| 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. |
| defaultCutoff | Number | The cutoff value used to determine when to stop traversing. |
| defaultTargetFacilityCount | int | The number of facilities to find. |
| directionsLanguage | String | The language used when computing directions. By default the task will use the language defined in the network layer used by the RouteTask. |
| directionsLengthUnits | String | The length units used when computing directions. By default the value defined by the routing network layer is used. |
| directionsOutputType | String | Defines the amount of direction information returned. The default value is standard. |
| 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 default value is false. |
| facilities | Object | The set of facilities loaded as network locations during analysis. |
| impedenceAttribute | String | The network attribute field name used as the impedance attribute during analysis. |
| incidents | Object | The set of incidents loaded as network locations during analysis. |
| outSpatialReference | SpatialReference | 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. |
| outputGeometryPrecision | Number | The output geometry precision. |
| outputGeometryPrecisionUnits | String | The units of the output geometry precision. The default value is esriUnknownUnits |
| outputLines | String | The type of output lines generated in the result. |
| pointBarriers | Object | 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. |
| polygonBarriers | Object | 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. |
| polylineBarriers | Object | 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. |
| restrictUTurns | String | Specifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your RouteTask. |
| restrictionAttributes | String[] | The list of network attribute names to be used as restrictions with the analysis. |
| returnDirections | Boolean | If true, directions will be generated and returned in the directions property of each RouteResult and RouteSolveResult. Default value is false. |
| returnFacilities | Boolean | If true, facilities will be returned with the analysis results. Default values is false. |
| returnIncidents | Boolean | If true, incidents will be returned with the analysis results. Default value is false. |
| returnPointBarriers | Boolean | If true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false. |
| returnPolygonBarriers | Boolean | If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false. |
| returnPolylineBarriers | Boolean | If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. Default value is false. |
| returnRoutes | Boolean | When true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. Default value is true. |
| timeOfDay | Date | The arrival or departure date and time. |
| timeOfDayUsage | String | Defines the way the timeOfDay value is used. |
| travelDirection | String | Options for traveling to or from the facility. Default values are defined by the newtork layer. See NATravelDirection for a list of valid values. |
| 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. |
var params = new esri.tasks.ClosestFacilityParameters(); params.defaultCutoff = 3.0; params.returnIncidents = false; params.returnRoutes = true; params.returnDirections = true;
| <String>attributeName | The name of the attribute. |
| <String>parameterName | The parameter name. |
| <String>value | The parameter value. |
//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"
});
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.
//specify incidents using a FeatureSetvar 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 greatervar 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"});
closestFacilityParams.restrictionAttributes = ["OneWay"];Override the service defaults and specify that no restrictions should be used.
closestFacilityParams.restrictionAttributes = ["none"];
var params = new esri.tasks.ClosestFacilityParameters(); params.returnDirections = true;
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)var params = new esri.tasks.ClosestFacilityParameters(); params.timeOfDay = new Date();
var params = new esri.tasks.ClosestFacilityParameters(); params.timeOfDayUsage = "start";