An abstraction to simplify making calls to ArcGIS Online and ArcGIS Server Geoprocessing services. You can find more information and the source code for this plugin here.


This object is typically instantiated by calling L.esri.GP.Service.createTask()


By default, the plugin assumes services are synchronous and that 'execute' is the appropriate path.

If you are working with an asynchronous service or one with a custom operation name and don't indicate corresponding information in the constructor, you'll have to leave the plugin enough time to make a roundtrip to the server to inquire before calling run().

The GP.task 'initialized' event is intended to help with this timing.

var myService = L.esri.GP.service({
    url: "https://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer/Profile"
var myTask = myService.createTask();

myTask.on('initialized', function(){
  myTask.setParam("inputFeature", polyline.toGeoJSON());
  myTask.run(function(error, geojson, response){


Method Returns Description
setParam(<String> inputParamName, <String||Boolean||Geometry> value) this Sets an input parameter named by the service itself. L.LatLng, L.Marker, L.LatLngBounds, and L.GeoJSON (both Features and Geometries) will be converted to GeoServices JSON to be passed in the request automatically.
run(<Function> callback) this Calls the corresponding Geoprocessing service, passing the previously supplied input parameters. For synchronous services, all result parameters are parsed and returned.
setOutputParam(<String> outputParamName) this (Optional) Only applicable for asynchronous services. Notifies the plugin of the parameter name to retrieve output for.
gpAsyncResultParam(<String> resultParamName, <Object> value) this (Optional) Sets a result parameter for Asynchronous geoprocessing services that require it.


The response from synchronous services will be a JSON object composed of name value pairs of output parameter names and their associated values. GPFeatureRecordSet layer output will converted to GeoJSON.

A single result from the geoprocessing service. Do not rely on all these properties being present in every result object.

Property Type Description
jobId <String> ID of processed job (only applicable for asynchronous services).
outputMapService <String> Url of temporary map service created by geoprocessing service, if its been designed to create one.

GP results conform to the following format

    // actual parameter name and data type are dependent on the service itself
    outputParamName: <L.GeoJSON> || <string> || <boolean>,
    outputGPFileParamName: {
        url: "https://server/arcgis/rest/directories/arcgisoutput/./_ags_856aed6eb_.png"
    jobId: "j7123be34ccfe45b4b47a51e867e0084b",
    mapService: "https://server/arcgis/rest/services/GPServiceName/MapServer/jobs/j7123be34ccfe45b4b47a51e867e0084b/"

Edit this page on GitHub