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.esri.tasks.ClosestFacilityParameters
| Constructor | Description |
|---|---|
| esri.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. |
| 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. |
| facilities | Object | The set of facilities loaded as network locations during analysis. |
| impedenceAttribute | String | The network attribute field name used as the impedence attribute during analysis. |
| incidents | Object | The set of incidents loaded as network locations during analysis. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| restrictionAttributes | String[] | The list of network attribute names to be used as restrictions with the analysis. |
| restrictUTurns | String | Specifies how U-Turns should be handled. The default is as defined in the specific routing network layer used in your RouteTask. |
| 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. |
| 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. |
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>parameterValue | The parameter value. |
var facilities = new esri.tasks.FeatureSet(); facilities.features = facilitiesGraphicsLayer.graphics;
The network attribute field name used as the impedence 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 impedence. 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.
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;
routeParams.restrictionAttributes = ["OneWay"];Override the service defaults and specify that no restrictions should be used.
routeParams.restrictionAttributes = ["none"];
params = new esri.tasks.ClosestFacilityParameters(); params.returnDirections=true;