This page describes an older version, please read about the latest version at:
https://developers.arcgis.com/en/flex/api-reference/
Packagecom.esri.ags.tasks
Classpublic class Geoprocessor
InheritanceGeoprocessor Inheritance BaseTask Inheritance flash.events.EventDispatcher

Represents a geoprocessing task resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). A geoprocessing task resource represents a single task in a geoprocessing service published using the ArcGIS Server and it supports one of the following two main operations: In addition, for a jobId:

Set the url to the ArcGIS Server REST resource that represents a Geoprocessor service, e.g. http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons. For more information on constructing a URL, see Using the ArcGIS Services Directory.


Example
ActionScript for a synchronous task using execute() that takes an input point and two parameters:
var mapPoint:Geometry = new MapPoint(-20, -10);

var featureSet:FeatureSet = new FeatureSet();
featureSet.features = [ { geometry: mapPoint } ];

var params:Object = new Object();
params.Input_Point = featureSet;
params.Days = 10;

var gp:Geoprocessor = new Geoprocessor();
gp.url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_Currents_World/GPServer/MessageInABottle";
gp.execute(params);
gp.addEventListener(GeoprocessorEvent.EXECUTE_COMPLETE, executeCompleteHandler);
gp.addEventListener(FaultEvent.FAULT, faultHandler);

See also

Concepts - Geoprocessing tasks
Live Sample - adding Geoprocessor with MXML.
Live Sample - adding Geoprocessor with ActionScript.
Live Sample - execute Geoprocessor, use result for a Query.


Public Properties
 PropertyDefined by
 Inheritedconcurrency : String = "multiple"
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
  executeLastResult : ExecuteResult
[Synchronous] The result from the last execute call.
Geoprocessor
  getInputLastResult : ParameterValue
[Asynchronous] The result from the last getInput call.
Geoprocessor
  getResultDataLastResult : ParameterValue
[Asynchronous] The result from the last getResultData call.
Geoprocessor
  getResultImageLastResult : ParameterValue
[Asynchronous] The result from the last getResultImage call.
Geoprocessor
  outputSpatialReference : SpatialReference
The well-known ID of the spatial reference of the output geometries.
Geoprocessor
  processSpatialReference : SpatialReference
The well-known ID of the spatial reference that the model will use to perform geometry operations.
Geoprocessor
 InheritedproxyURL : String
The URL to proxy the request through.
BaseTask
 InheritedrequestTimeout : Number = -1
The request timeout in seconds.
BaseTask
 InheritedshowBusyCursor : Boolean = false
If true, a busy cursor is displayed while a service is executing.
BaseTask
  submitJobLastResult : JobInfo
[Asynchronous] The result from the last submitJob call.
Geoprocessor
 Inheritedtoken : String
Token for accessing a secure task.
BaseTask
  updateDelay : Number
[Asynchronous] The time interval in milliseconds between each job status request sent to an asynchronous geoprocessing task.
Geoprocessor
 Inheritedurl : String
URL of the task.
BaseTask
Public Methods
 MethodDefined by
  
Geoprocessor(url:String = null)
Creates a new Geoprocessor object that represents the geoprocessing task.
Geoprocessor
  
cancelJobStatusUpdates(jobId:String):void
Cancels the periodic job status updates initiated automatically when submitJob() is invoked for the job identified by jobId.
Geoprocessor
  
checkJobStatus(jobId:String, responder:IResponder = null):AsyncToken
Sends a request to the geoprocessing task for the current state of the job identified by jobId.
Geoprocessor
  
execute(inputParameters:Object, responder:IResponder = null):AsyncToken
[Synchronous] Sends a request to the server to execute a synchronous geoprocessing task.
Geoprocessor
  
getInput(jobId:String, parameterName:String, responder:IResponder = null):AsyncToken
[Asynchronous] Sends a request to the server...
Geoprocessor
  
getResultData(jobId:String, parameterName:String, responder:IResponder = null):AsyncToken
[Asynchronous] Sends a request to the Geoprocessor task to get the task result identified by jobId and resultParameterName.
Geoprocessor
  
getResultImage(jobId:String, parameterName:String, imageParameters:ImageParameters, responder:IResponder = null):AsyncToken
[Asynchronous] Sends a request to the geoprocessing task to get the task result identified by jobId and resultParameterName as an image.
Geoprocessor
  
getResultImageLayer(jobId:String, parameterName:String, imageParameters:ImageParameters = null):GPResultImageLayer
[Asynchronous] Creates and configures a GPResultImageLayer instance ready to be added to a Map.
Geoprocessor
  
submitJob(inputParameters:Object, responder:IResponder = null, statusResponder:IResponder = null):AsyncToken
[Asynchronous] Submits a job request to the server to execute an asynchronous geoprocessing task.
Geoprocessor
Events
 EventSummaryDefined by
   Dispatched when an execute operation of the geoprocessing task successfully completes.Geoprocessor
   Dispatched when a Geoprocessor request fails.Geoprocessor
   Dispatched when a getInput operation of the geoprocessing task successfully completes.Geoprocessor
   Dispatched when a getResultData operation of the geoprocessing task successfully completes.Geoprocessor
   Dispatched when a getResultImage operation of the geoprocessing task successfully completes.Geoprocessor
   Dispatched when a submitJob operation of the geoprocessing task successfully completes.Geoprocessor
   Dispatched when a checkStatus operation of the geoprocessing task successfully completes.Geoprocessor
Property detail
executeLastResultproperty
public var executeLastResult:ExecuteResult

[Synchronous] The result from the last execute call.

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

getInputLastResultproperty 
public var getInputLastResult:ParameterValue

[Asynchronous] The result from the last getInput call.

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

getResultDataLastResultproperty 
public var getResultDataLastResult:ParameterValue

[Asynchronous] The result from the last getResultData call.

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

getResultImageLastResultproperty 
public var getResultImageLastResult:ParameterValue

[Asynchronous] The result from the last getResultImage call.

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

outputSpatialReferenceproperty 
outputSpatialReference:SpatialReference  [read-write]

The well-known ID of the spatial reference of the output geometries. If not specified, the output geometries are in the spatial reference of the input geometries. If processSpatialReferencew is specified and outputSpatialReference is not specified, the output geometries are in the spatial reference of the process spatial reference.

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

Implementation
    public function get outputSpatialReference():SpatialReference
    public function set outputSpatialReference(value:SpatialReference):void
processSpatialReferenceproperty 
processSpatialReference:SpatialReference  [read-write]

The well-known ID of the spatial reference that the model will use to perform geometry operations. If processSpatialReference is specified and outputSpatialReference is not specified, the output geometries are in the spatial reference of the process spatial reference.

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

Implementation
    public function get processSpatialReference():SpatialReference
    public function set processSpatialReference(value:SpatialReference):void
submitJobLastResultproperty 
public var submitJobLastResult:JobInfo

[Asynchronous] The result from the last submitJob call.

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

updateDelayproperty 
updateDelay:Number  [read-write]

[Asynchronous] The time interval in milliseconds between each job status request sent to an asynchronous geoprocessing task.

The default value is 1000 milliseconds.

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

Implementation
    public function get updateDelay():Number
    public function set updateDelay(value:Number):void
Constructor detail
Geoprocessor()constructor
public function Geoprocessor(url:String = null)

Creates a new Geoprocessor object that represents the geoprocessing task.

Parameters
url:String (default = null) — The URL of the geoprocessing task.
Method detail
cancelJobStatusUpdates()method
public function cancelJobStatusUpdates(jobId:String):void

Cancels the periodic job status updates initiated automatically when submitJob() is invoked for the job identified by jobId. You can still obtain the status of this job by calling the checkStatus() method at your own discretion.

Parameters
jobId:String
checkJobStatus()method 
public function checkJobStatus(jobId:String, responder:IResponder = null):AsyncToken

Sends a request to the geoprocessing task for the current state of the job identified by jobId. Upon receiving the response, the statusUpdate event is fired and the optional callback function is invoked.

Parameters
jobId:String — A string that uniquely identifies a job on the server. It is created when a job is submitted for execution and later used to check its status and retrieve the results.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken
execute()method 
public function execute(inputParameters:Object, responder:IResponder = null):AsyncToken

[Synchronous] Sends a request to the server to execute a synchronous geoprocessing task. On completion, the executeComplete event is fired and the optional callback function is invoked.

Parameters
inputParameters:Object — The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. These input parameters are listed in the parameters field of the associated geoprocessing task resource.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken

See also

getInput()method 
public function getInput(jobId:String, parameterName:String, responder:IResponder = null):AsyncToken

[Asynchronous] Sends a request to the server... On completion, the getInputComplete event is fired and the optional callback function is invoked.

Parameters
jobId:String — A string that uniquely identifies a job on the server. It is created when a job is submitted for execution and later used to check its status and retrieve the results.
 
parameterName:String — The responder to call for status.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken
getResultData()method 
public function getResultData(jobId:String, parameterName:String, responder:IResponder = null):AsyncToken

[Asynchronous] Sends a request to the Geoprocessor task to get the task result identified by jobId and resultParameterName. On completion, the getResultDataComplete event is fired and the optional callback function is invoked.

Parameters
jobId:String — A string that uniquely identifies a job on the server. It is created when a job is submitted for execution and later used to check its status and retrieve the results.
 
parameterName:String — The responder to call for status.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken
getResultImage()method 
public function getResultImage(jobId:String, parameterName:String, imageParameters:ImageParameters, responder:IResponder = null):AsyncToken

[Asynchronous] Sends a request to the geoprocessing task to get the task result identified by jobId and resultParameterName as an image. This gives you a static image instead of a map layer. The image cannot be added to the map.

Parameters
jobId:String — The jobId returned from JobInfo.
 
parameterName:String — The name of the result parameter as defined in ArcGIS Services Directory.
 
imageParameters:ImageParameters — Specifies the properties of the result image.
 
responder:IResponder (default = null) — The responder to call on result or fault.

Returns
AsyncToken
getResultImageLayer()method 
public function getResultImageLayer(jobId:String, parameterName:String, imageParameters:ImageParameters = null):GPResultImageLayer

[Asynchronous] Creates and configures a GPResultImageLayer instance ready to be added to a Map.

Parameters
jobId:String — The jobId returned from JobInfo.
 
parameterName:String — The name of the result parameter as defined in ArcGIS Services Directory.
 
imageParameters:ImageParameters (default = null) — Contains various options that can be specified when generating a dynamic map image.

Returns
GPResultImageLayer — A new GPResultImageLayer.
submitJob()method 
public function submitJob(inputParameters:Object, responder:IResponder = null, statusResponder:IResponder = null):AsyncToken

[Asynchronous] Submits a job request to the server to execute an asynchronous geoprocessing task. On completion, the jobComplete event is fired and optional callback functions are invoked.

Parameters
inputParameters:Object — The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. These input parameters are listed in the parameters field of the associated geoprocessing task resource.
 
responder:IResponder (default = null) — The responder to call on result or fault.
 
statusResponder:IResponder (default = null) — The responder to call on status updates.

Returns
AsyncToken

See also

Event detail
executeCompleteevent 
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.EXECUTE_COMPLETE

Dispatched when an execute operation of the geoprocessing task successfully completes. This only applies to tasks submitted with the execute method (not the submitJob method).

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

faultevent  
Event object type: mx.rpc.events.FaultEvent

Dispatched when a Geoprocessor request fails. Applies to all methods.

getInputCompleteevent  
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.GET_INPUT_COMPLETE

Dispatched when a getInput operation of the geoprocessing task successfully completes.

Defines the value of the type property of a getInputComplete event object.

getResultDataCompleteevent  
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.GET_RESULT_DATA_COMPLETE

Dispatched when a getResultData operation of the geoprocessing task successfully completes.

Defines the value of the type property of a getResultDataComplete event object.

getResultImageCompleteevent  
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.GET_RESULT_IMAGE_COMPLETE

Dispatched when a getResultImage operation of the geoprocessing task successfully completes.

Defines the value of the type property of a getResultImageComplete event object.

jobCompleteevent  
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.JOB_COMPLETE

Dispatched when a submitJob operation of the geoprocessing task successfully completes.

Defines the value of the type property of a jobComplete event object.

statusUpdateevent  
Event object type: com.esri.ags.events.GeoprocessorEvent
GeoprocessorEvent.type property = com.esri.ags.events.GeoprocessorEvent.STATUS_UPDATE

Dispatched when a checkStatus operation of the geoprocessing task successfully completes. This only applies to tasks submitted with the submitJob method (not the execute method).

Defines the value of the type property of a statusUpdate event object.