Packagecom.esri.ags.tasks
Classpublic class RouteTask
InheritanceRouteTask Inheritance BaseTask Inheritance flash.events.EventDispatcher

Since : ArcGIS API for Flex 1.2

Helps you solve a routing problem by finding a least-cost path between multiple locations using a network service exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3.1 and later). You can route between two or more locations, optionally avoiding barriers, finding best sequence and getting driving directions.

The "cost" (of the least-cost path) is calculated based on an impedance attribute which you define in a network dataset. Impedance can be time or distance, or even a more abstract variable such as "scenic value".

Note: RouteTask, and other routing related classes, were added in version 1.2 and requires ArcGIS Server 9.3.1 or above and a "route" layer. A "route" layer is a layer of type "esriNAServerRouteLayer".

RouteTask in Action

See also

com.esri.ags.tasks.supportClasses.RouteParameters
com.esri.ags.tasks.supportClasses.RouteSolveResult
com.esri.ags.events.RouteEvent
Concepts - Routing tasks
Solve Route (Network Service) [ArcGIS REST API]
Live sample - Basic routing.
Live sample - Routing with barriers.
Live sample - Routing with driving directions.


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 : RouteSolveResult
The result returned from last call to the solve function.
RouteTask
 Inheritedtoken : String
Token for accessing a secure task.
BaseTask
 Inheritedurl : String
URL of the task.
BaseTask
Public Methods
 MethodDefined By
  
RouteTask(url:String = null)
Creates a new RouteTask instance.
RouteTask
  
solve(routeParameters:RouteParameters, responder:IResponder = null):AsyncToken
Solve the route.
RouteTask
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.RouteTask
  Dispatched on success.RouteTask
Property Detail
solveLastResultproperty
solveLastResult:RouteSolveResult

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():RouteSolveResult
    public function set solveLastResult(value:RouteSolveResult):void
Constructor Detail
RouteTask()Constructor
public function RouteTask(url:String = null)

Creates a new RouteTask 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(routeParameters:RouteParameters, responder:IResponder = null):AsyncToken

Solve the route.

Parameters

routeParameters:RouteParameters — The criteria used to solve the route.
 
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.RouteEvent
RouteEvent.type property = com.esri.ags.events.RouteEvent.SOLVE_COMPLETE

Dispatched on success.

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