GeometryService project from wkid 4269 to 3400

2675
3
Jump to solution
03-27-2012 07:11 AM
DenisLapierre
New Contributor II
Hi, I'm using the project function of esri.tasks.GeometryService and I have a problem with my particular projection.

I've tried with different projections and some in the wkid over 32000 works fine but it seems that there are a few projections which I cannot project too (including wkid:3400 the one I need it too project).
My input wkid is 4269 (GCS_North_American_1983) and output wkid is 3400 (NAD_1983_10TM_AEP_Forest).
I've read on the forums here that the project service cannot change the reference system, but here I'm on the same NAD83 ref. sys.

Anyone has an idea on how I could resolve this problem?

<code>
//features is the input, an array of points
var gsvc = new esri.tasks.GeometryService("http://oxpgisws01d.env.gov.ab.ca/ArcGIS/rest/services/Geometry/GeometryServer");
mapSR =  new esri.SpatialReference({ wkid: 3400});

gsvc.project(features, mapSR, function(projectedPoints) {
features = projectedPoints;
        }
</code>

Thanks
0 Kudos
1 Solution

Accepted Solutions
DenisLapierre
New Contributor II
Actually I found out what was the problem. (very stupid indeed)

It is simply that I was using coordinates that fell outside of the projection limitations.
Because at first, I was using the esri.geometry.geographicToWebMercator() function and the 0 longitude with that projection is completely different than the 0 longitude of my projection. So when I projected to the projection I wanted, I had a Nan as x,y outputs.

Recommandation : Verify if your data coordinates are logical. Very simple, but can be forgotten.

View solution in original post

0 Kudos
3 Replies
DenisLapierre
New Contributor II
I found out that in js 2.8 with ArcGIS 10.0 installed, we supposed to be able to create an esri.SpatialReference with a wkt as an entry as shown in the link below.

I followed the exemple showed here, but even the exemple did not work.
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm

Any idea?
0 Kudos
nicogis
MVP Frequent Contributor
I don't know these projection but:Is features an array of geometry with spatial reference set?

  gsvc.project([ point ], outSR, function(projectedPoints) { 
        pt = projectedPoints[0]; 
  });


if you must do transformation of datum you can use 10.1 with (for now) esri.request:
        var g = { geometryType:"esriGeometryPoint", geometries:[wgsPt.toJson()] };
        var params = { f:"json", geometries:dojo.toJson(g), inSR:4326,
            outSR:map.spatialReference.wkid, transformation:1660, transformForward:false        
       };

        var requestHandle = esri.request({
            url:"http://servicesbeta4.esri.com/arcgis/rest/services/Geometry/GeometryServer/Project",
            content:params,
            callbackParamName:"callback",
            load:dojo.hitch(dojo.mixins(this, {lat:lat, lon:lon}), "OnSuccessProject")
        }, {useProxy:false});
0 Kudos
DenisLapierre
New Contributor II
Actually I found out what was the problem. (very stupid indeed)

It is simply that I was using coordinates that fell outside of the projection limitations.
Because at first, I was using the esri.geometry.geographicToWebMercator() function and the 0 longitude with that projection is completely different than the 0 longitude of my projection. So when I projected to the projection I wanted, I had a Nan as x,y outputs.

Recommandation : Verify if your data coordinates are logical. Very simple, but can be forgotten.
0 Kudos