I am facing a strange issue when trying to execute GP service when my map's spatial-reference is Web Mercator. I appreciate all help.

I have a JavaScript API application. Initially I only had my map service used in this application. The Map Service I am using is in NAD27. I execute a GP service from JavaScript API and it works fine. In fiddler I can see the request being send to the server. Now I need to add ESRI image layer to map. So I now have my map's spatial reference as web mercarter. Now if I execute the GP Service nothing happens. No request being send to server, because nothing gets recorded in fiddler.

If I test the same request from ArcGIS Server rest end point it works fine.

Here is the request string in NAD27 and web mercarter. Only difference is wikid.


Web Mercator request

  • What does your Geo-processing Service do? have you tested on different browsers, including Google Chrome & Firefox? May 17, 2013 at 17:42
  • Hi Devadatta, Thanks for the fast response. MY GP Service returns one polygon. As I said, if I use this same request from REST end point, it works. If REST end point request is web mercarter, I can see the coordinates of the polygon in meters. If the REST endpoint request is NAD27, the result polygon's coordinates are in degrees. So there is no issue with the GP service itslef. I tested on IE and chrome. I doubt this is a browser issue.
    – Cyril
    May 17, 2013 at 19:19
  • I noticed that gp.execute() method is throwing the following error when I execute the GP tool in web Mercarter. TypeError: Cannot read property 'xmin' of undefined
    – Cyril
    May 20, 2013 at 15:23

1 Answer 1


I am able to find the reason for the above error. It looks like an ESRI bug to me.

One of the parameter that I pass to gp.Execute() method is a FeatureSet. This FeatureSet contain a polygon with empty geometry and few attributes. My output will add geometry to this FeatureSet. When map's spatial reference is GCS, the GP tool works fine. But when the spatial reference is PCS, the FeatureSet requires some geometry for the polygon. I am not sure why it is so. So I am adding few dummy rings to the polygon to get it working.

The line polygon.addRing ... below was added to fix the issue discussed above. I guess we can add any dummy ring values there.

If anybody can give a better reason why this is only required when the spatial reference is PCS, I appreciate it.

    var attr = {"id":1, "legalParams":legalParams };      
    var polygon = new esri.geometry.Polygon(map.spatialReference);
    polygon.addRing([[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]]);//This line is added to fix the issue discussed above. This is not required for GCS
    var graphic = new esri.Graphic(polygon, null, attr, null);
    legalFeatureset = new esri.tasks.FeatureSet();
    legalFeatureset.spatialReference = map.spatialReference;
    var features = [];
    legalFeatureset.features = features;
    legalFeatureset.geometryType = "esriGeometryPolygon";

   gp.execute(params, drawGeoprocessingResult, getError);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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