I use a method based on the "project a point" sample to project points from S-JTSK (wkid 102067) to Web Mercator (wkid 102100) and they are ~100m away from their correct position. This happens when I convert them to WGS84 (wkid 4326) as well. Points in other coordinate systems are projected correctly. I tried to use another geometry server, but the problem is obviously not there. Explicitly setting the transformation didn't change anything and setting forward transformation is not suitable for projected to projected SRS. When transforming to WGS84, I end in the Atlantic and the point even doesn't draw there. I tried to use WGS84 as an intermediate step, but the final result is the same.

My code:

reprojectStart: function (point)    {
    var sr = new esri.SpatialReference({ 
         wkid: thisDijit.map.spatialReference.wkid 
    var gsvc = new GeometryService("https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

    var params = new ProjectParameters();
    params.geometries = [ point ];
    params.outSR = new SpatialReference(102100);
    params.transformForward = true;
    var def = gsvc.project(params, function(projectedPoints) {
        var pt = projectedPoints[0];
        point.x = pt.x;
        point.y = pt.y;
        point.spatialReference = pt.spatialReference;
        return this.anotherMethod(point);

The only workaround I know now is to either avoid S-JTSK or have both map and the points in it.

I wonder whether it is a bug ("coordinate system not fully supported") and I should report it to ESRI, or if I have some error in my code. Btw. it's a Web AppBuilder custom widget, so it's possible that it works otherwise but clashes with something in WAB.

EDIT: Transformation wkids I've tried: 1623,1625, 4827, 4829 and 5239. @mkennedy's comment encouraged me to try them again and I found the transformation is not being set correctly. params.transformation.wkid causes params.transformation not defined error. params.transformation = {wkid:5239} makes an object, but AFAIK true transformation object should have more attributes than just wkid. Other ProjectParameters attributes are correct. So the question basically changes to how to set the transform parameter when the way in the official example doesn't work?

EDIT2: I started examinating another way, through proj4js. However, I face some problems while making it work.


When you say "I tried to use another geometry server, but the problem is obviously not there", do you mean it works with other GeometryServices but not the one hosted on tasks.arcgisonline.com?

Either way, https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer is an old server (10.0) that you probably shouldn't be using. The sample you link to has been updated to use a newer server - see the code in https://developers.arcgis.com/javascript/jssamples/util_project.html. (I notice that the sample description still mention the old task server, so ignore that).

  • I tried our geometry server, which didn't help. I'll find out its version on Monday; if it's not new enough, I'll try another, new geometry server. – Pavel V. Apr 10 '16 at 9:17
  • I don't know why the previous test failed, but now I loaded our 10.2.1 geometry service and the projection is accurate now. – Pavel V. Apr 11 '16 at 6:29

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.