This page describes an older version, please see latest API at http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/ClosestFacilityTask.html.
Packagecom.esri.ags.tasks
Classpublic class ClosestFacilityTask
InheritanceClosestFacilityTask Inheritance BaseTask Inheritance flash.events.EventDispatcher

Since : ArcGIS API for Flex 2.0

Helps you find closest facilities around any location(incident) on a network.

When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. Once you've found the closest facilities, you can display the best route to or from them, return the travel cost for each route, and display directions to each facility.

You can also specify a cutoff cost beyond which ArcGIS Network Analyst should not search for a facility. For instance, you can set up a closest facility problem to search for hospitals within a 15-minute drive time of the site of an accident. Any hospitals that take longer than 15 minutes to reach will not be included in the results.

Note: ClosestFacilityTask, and other closest facility related classes, requires ArcGIS Server 10.0 or above and a "closest facility" layer. A "closest facility" layer is a layer of type "esriNAServerClosestFacilityLayer".

ClosestFacilityTask in Action

See also

com.esri.ags.tasks.supportClasses.ClosestFacilityParameters
com.esri.ags.tasks.supportClasses.ClosestFacilitySolveResult
com.esri.ags.events.ClosestFacilityEvent
Closest Facility [ArcGIS desktop help]
Live sample - Using Closest Facility


Public Properties
 PropertyDefined By
 InheritedautoNormalize : Boolean
If true, normalizes the geometries across the central meridian.
BaseTask
 Inheritedconcurrency : String
Value that indicates how to handle multiple calls to the same task.
BaseTask
 InheriteddisableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
BaseTask
 Inheritedmethod : String
URL request method to use.
BaseTask
 InheritedproxyURL : String
The URL to proxy the request through.
BaseTask
 InheritedrequestTimeout : int
The request timeout in seconds.
BaseTask
 InheritedshowBusyCursor : Boolean
If true, a busy cursor is displayed while a service is executing.
BaseTask
  solveLastResult : ClosestFacilitySolveResult
The result returned from last call to the solve function.
ClosestFacilityTask
 Inheritedtoken : String
Token for accessing a secure task.
BaseTask
 Inheritedurl : String
URL of the task.
BaseTask
Public Methods
 MethodDefined By
  
ClosestFacilityTask(url:String = null)
Creates a new ClosestFacilityTask instance.
ClosestFacilityTask
  
solve(closestFacilityParameters:ClosestFacilityParameters, responder:IResponder = null):AsyncToken
Solve the closest facility.
ClosestFacilityTask
Protected Methods
 MethodDefined By
 Inherited
sendURLVariables(urlSuffix:String, urlVariables:URLVariables, responder:IResponder, operation:Function):AsyncToken
Sends an HTTP request.
BaseTask
Events
 Event Summary Defined By
  Dispatched when a RouteTask fails.ClosestFacilityTask
  Dispatched on success.ClosestFacilityTask
Property Detail
solveLastResultproperty
solveLastResult:ClosestFacilitySolveResult

The result returned from last call to the solve function.

This property can be used as the source for data binding.


Implementation
    public function get solveLastResult():ClosestFacilitySolveResult
    public function set solveLastResult(value:ClosestFacilitySolveResult):void
Constructor Detail
ClosestFacilityTask()Constructor
public function ClosestFacilityTask(url:String = null)

Creates a new ClosestFacilityTask instance.

Parameters
url:String (default = null) — [optional] URL to the ArcGIS Server REST resource that represents a route service.
Method Detail
solve()method
public function solve(closestFacilityParameters:ClosestFacilityParameters, responder:IResponder = null):AsyncToken

Solve the closest facility.

Parameters

closestFacilityParameters:ClosestFacilityParameters — The criteria used to solve the closest facility.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken
Event Detail
fault Event
Event Object Type: mx.rpc.events.FaultEvent
FaultEvent.type property = mx.rpc.events.FaultEvent.FAULT

Dispatched when a RouteTask fails.

solveComplete Event  
Event Object Type: com.esri.ags.events.ClosestFacilityEvent
ClosestFacilityEvent.type property = com.esri.ags.events.ClosestFacilityEvent.SOLVE_COMPLETE

Dispatched on success.

Defines the value of the type property of an solveComplete event object.