| Package | com.esri.ags.tasks |
| Class | public class ClosestFacilityTask |
| Inheritance | ClosestFacilityTask BaseTask flash.events.EventDispatcher |
| Since : | ArcGIS API for Flex 2.0 |
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".
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | autoNormalize : Boolean
If true, normalizes the geometries across the central meridian. | BaseTask | |
![]() | concurrency : String
Value that indicates how to handle multiple calls to the same task. | BaseTask | |
![]() | disableClientCaching : 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 | |
![]() | method : String
URL request method to use. | BaseTask | |
![]() | proxyURL : String
The URL to proxy the request through. | BaseTask | |
![]() | requestTimeout : int
The request timeout in seconds. | BaseTask | |
![]() | showBusyCursor : 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 | ||
![]() | token : String
Token for accessing a secure task. | BaseTask | |
![]() | url : String
URL of the task. | BaseTask | |
| Method | Defined By | ||
|---|---|---|---|
ClosestFacilityTask(url:String = null)
Creates a new ClosestFacilityTask instance. | ClosestFacilityTask | ||
solve(closestFacilityParameters:ClosestFacilityParameters, responder:IResponder = null):AsyncToken
Solve the closest facility. | ClosestFacilityTask | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a RouteTask fails. | ClosestFacilityTask | |||
| Dispatched on success. | ClosestFacilityTask | |||
| solveLastResult | property |
solveLastResult:ClosestFacilitySolveResultThe result returned from last call to the solve function.
This property can be used as the source for data binding.
public function get solveLastResult():ClosestFacilitySolveResult public function set solveLastResult(value:ClosestFacilitySolveResult):void| ClosestFacilityTask | () | Constructor |
public function ClosestFacilityTask(url:String = null)Creates a new ClosestFacilityTask instance.
Parametersurl:String (default = null) — [optional] URL to the ArcGIS Server REST resource that represents a route service.
|
| solve | () | method |
public function solve(closestFacilityParameters:ClosestFacilityParameters, responder:IResponder = null):AsyncTokenSolve 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.
|
AsyncToken |
| fault | Event |
mx.rpc.events.FaultEventmx.rpc.events.FaultEvent.FAULTDispatched when a RouteTask fails.
| solveComplete | Event |
com.esri.ags.events.ClosestFacilityEventcom.esri.ags.events.ClosestFacilityEvent.SOLVE_COMPLETEDispatched on success.
Defines the value of thetype property of an solveComplete event object.