require(["esri/tasks/ClosestFacilityParameters"], function(ClosestFacilityParameters) { /* code goes here */ });
Name | Summary |
---|---|
new ClosestFacilityParameters() | Creates a new ClosestFacilityParameters object. |
Name | Type | Summary |
---|---|---|
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 | Number | The number of facilities to find. |
directionsLanguage | String | The language used when computing directions. |
directionsLengthUnits | String | The length units used when computing directions. |
directionsOutputType | String | Defines the amount of direction information returned. |
directionsStyleName | String | The style to be used when returning directions. |
directionsTimeAttribute | String | The name of the attribute field that contains the drive time values. |
doNotLocateOnRestrictedElements | Boolean | When true, restricted network elements should be considered when finding network locations. |
facilities | Object | The set of facilities loaded as network locations during analysis. |
impedanceAttribute | 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. |
outputGeometryPrecision | Number | The output geometry precision. |
outputGeometryPrecisionUnits | String | The units of the output geometry precision. |
outputLines | String | The type of output lines to be generated in the result. |
pointBarriers | Object | The set of point barriers loaded as network locations during analysis. |
polygonBarriers | Object | The set of polygon barriers loaded as network locations during analysis. |
polylineBarriers | Object | The set of polyline barriers loaded as network locations during analysis. |
restrictUTurns | String | Specifies how U-Turns should be handled. |
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. |
returnFacilities | Boolean | If true, facilities will be returned with the analysis results. |
returnIncidents | Boolean | If true, incidents will be returned with the analysis results. |
returnPointBarriers | Boolean | If true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. |
returnPolygonBarriers | Boolean | If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. |
returnPolylineBarriers | Boolean | If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. |
returnRoutes | Boolean | When true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. |
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. |
travelMode | Object | Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. |
useHierarchy | Boolean | If true, the hierarchy attribute for the network will be used in analysis. |
require([ "esri/tasks/ClosestFacilityParameters", ... ], function(ClosestFacilityParameters, ... ) { var params = new ClosestFacilityParameters(); params.defaultCutoff = 3.0; params.returnIncidents = false; params.returnRoutes = true; params.returnDirections = true; ... });
String[]
> accumulateAttributesObject[]
> attributeParameterValues<String>attributeName | The name of the attribute. |
<String>parameterName | The parameter name. |
<String>value | The parameter value. |
attributeParameterValues
>< > attributeName |
Required | Name of the attribute, for example, attributeName:"Avoid paved roads". |
< > parameterName |
Required | Name of the parameter, for example, parameterValue:"Restriction usage". |
< > value |
Required | The string value, for example, value:"AVOID_HIGH". |
Number
> defaultCutoffNumber
> defaultTargetFacilityCountString
> directionsLanguageString
> directionsLengthUnitsString
> directionsOutputTypecomplete | complete-no-events | instructions-only | standard | summary-only
String
> directionsStyleNameString
> directionsTimeAttributeBoolean
> doNotLocateOnRestrictedElementstrue | false
Object
> facilitiesrequire([ "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
> impedanceAttributeThe 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//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
> outSpatialReferenceNumber
> outputGeometryPrecisionString
> outputGeometryPrecisionUnitsString
> outputLinesObject
> pointBarriersObject
> polygonBarriersObject
> polylineBarriersString
> restrictUTurnsString[]
> restrictionAttributesrequire([ "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
> returnDirectionstrue | false
false
require([ "esri/tasks/ClosestFacilityParameters", ... ], function(ClosestFacilityParameters, ... ) { var params = new esri.tasks.ClosestFacilityParameters(); params.returnDirections = true; ... });
Boolean
> returnFacilitiestrue | false
false
Boolean
> returnIncidentstrue | false
false
Boolean
> returnPointBarrierstrue | false
false
Boolean
> returnPolygonBarrierstrue | false
false
Boolean
> returnPolylineBarrierstrue | false
false
Boolean
> returnRoutestrue | false
Date
> timeOfDaytravelDirection
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)require([ "esri/tasks/ClosestFacilityParameters", ... ], function(ClosestFacilityParameters, ... ) { var params = new ClosestFacilityParameters(); params.timeOfDay = new Date(); ... });
String
> timeOfDayUsagestart | end
require([ "esri/tasks/ClosestFacilityParameters", ... ], function(ClosestFacilityParameters, ... ) { var params = new ClosestFacilityParameters(); params.timeOfDayUsage = "start"; ... });
String
> travelDirectionObject
> travelModesupportedTravelModes
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)Null
travelMode
>< > 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. |
< > description |
Required | A description of the travel mode used. |
< > 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. |
< > id |
Required | Unique identifier for the travel mode. |
< > 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. |
< > 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". |
< > 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. |
< > simplicationToleranceUnits |
Required | Possible values are: "esriFeet", "esriKilometers", "esriMeters", "esriMiles", "esriNauticalMiles", and "esriYards". |
< > simplificationTolerance |
Required | How much to generalize the output geometry. |
< > 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. |
< > type |
Required | The travel mode type. Possible values are: "AUTOMOBILE", "TRUCK", "WALK", or "OTHER". |
< > useHierarchy |
Required | Indicates whether or not to use a hierarchical road classification for faster analysis. |
< > uturnAtJunctions |
Required | Specify where u-turns are allowed. Possible values are: "esriNFSBAllowBacktrack", "esriNFSBAtDeadEndsOnly", "esriNFSBNoBacktrack", and "esriNFSBAtDeadEndsAndIntersections". |
Boolean
> useHierarchytrue | false