I have a geoprocessing service that works fine in ArcMap and ArcGIS online.


I am trying to integrate it into an esri leaflet project. http://argis.ualr-iea.org/artrans/.

The service runs and returns data, but the results are not shown on the map, there are no errors and I don't recognize the Lat / Long returned?

To run this, I have an onclick handler set up, so just set up a breakpoint on line 504 (photo below) and click anywhere on the map to run the GP service.

Debug screen


the service is returning web mercator northings and eastings (wkid:3857 / 102100) not raw wgs84 lat/lon coordinates (wkid:4326). you can get your GP service to return lat/long coordinates by supplying 4326 as the 'Output Spatial Reference' in the UI.


i snooped the web traffic when the actual request is made and it appears that the corresponding parameter name defined for your service is actually env:outSR. i've never seen one with a colon in it before, but there's a first time for everything i guess.

gpTask.setParam('env:outSR', 4326);
| improve this answer | |
  • Awesome to see markers, getting closer, this works the first time, subsequent runs produce a 400 error "The coordinates or measures are out of bounds." . When I stopped the service and restarted it, it worked again the first time, when I restarted the service again and commented out the "env:outSR" line, it works everytime, but of course no markers on the leaflet side. Is the "env:outSR" an environment variable that the server holds on to once changed? Is there a best practice I should be following? Thanks – joffreyj Apr 13 '17 at 15:26
  • So I changed my map and all layers to wkid:4326, ran and republished my model and it works consistently now, You definitely got me on the right track, appreciate the help! – joffreyj Apr 13 '17 at 19:16

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.