Does anyone know of an example of a leaflet map with a geoprocessing service? Is it possible? What would the code look like?

I know ESRI Leaflet allows feature layers and map layers but I can't find anything on geoprocessing services.

  • What type of geoprocessing services? You should be able to use the ArcGIS JavaScript API. Nov 22 '13 at 17:51
  • A tool I created in model builder and published to our gis server. I am familiar with the ArcGIS JavaScript API just wasn't sure because I haven't been able to find any examples of this.
    – bailey
    Nov 22 '13 at 17:53
  • I can confirm this -- I have a Python script Geoprocessing Service on ArcGIS Server. I shot off an ajax call with jQuery, got back a JSON response, parsed the response and used it on my Leafletjs mapping application. I'd post a fiddle but the server is behind a firewall.
    – Roy
    Jul 30 '14 at 11:40

I think there is some misunderstatement of the ArcGIS JS API. Its focused on building Web mapping Clients in the browser, and has nothing to do with ArcGIS Server Geoprocessing. For sure ArcGIS Server Services are the major data source for an ArcGIS JS API App, but, you can also use another JS Framework for building your map app, like leaflet, openlayers or mapbox.

ArcGIS Geoprocessing Services (as any other ArcGIS Server Service) can be called via the REST API. It`s well documented here (http://resources.arcgis.com/en/help/main/10.1/index.html#/Task_operation_execute_REST/0057000000m5000000/)

I would recommend a Library like jQuery to to call the REST API in an AJAX like style, Then, depending on what your Geoprocessing Tool does, get the response, build some JS Objects out of it (Leaflet markers, or whatever) and present it. Thats all. So, to answer your question: Yes for sure it is possible. How it looks like, depends on the tool you are planning to integrate. Perhaps you could describe more precisely what you are planning to solve in your app.

  • +1 this is the best answer -- Send request, get JSON response. What you do with that JSON should be mapping API agnostic.
    – Roy
    Jul 28 '14 at 23:48

It does not appear that any of the Javascript options outside of the ArcGIS Javascript APIs for integrating with Esri services offer much beyond feature access and geocoding. You could include the ArcGIS Javascript API in your app and only require/import the esri/tasks/Geoprocessor part. Examples like this seem to separate the Geoprocessing tool call pretty cleanly from the mapping part; should be easy enough to adapt to your web application.

  • That's what I was thinking too. I'll report back if I can make something work.
    – bailey
    Nov 22 '13 at 18:10

You might want to check this out.



Is there a benefit in having this tool used on an open-source platform?

  • I don't know if there is necessarily a benefit to using an open-source platform in this case but I am much more comfortable with using Leaflet. Not finding examples of this done before also makes it more interesting to me.
    – bailey
    Nov 22 '13 at 19:55
  • If you notice in the source for geoservices-js there is support for authentication, feature services, and geocoding, but not for consuming geoprocessing services. Same with esri-leaflet, it's mostly for accessing features and basemaps. Nov 22 '13 at 20:04
  • I noticed that in the source too. I haven't messed with it enough and it seems like there isn't anyone out there who'd actually done anything with it yet. The docs are basically non-existent. Dec 10 '13 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.