3

I have requirement to convert UTM NAD 1927 Northing (4804172), Esting(753352) to Geographic coordinatesystem(Degrees Minutes, Seconds).

Iam doing like below

m_mapPoint[0] = new esri.geometry.Point(4804172, 753352, new esri.SpatialReference({ wkid: 26712 })); var geogPt = esri.geometry.webMercatorToGeographic(m_mapPoint[0]); gsvc.project([geogPt], outSRgc83, convrtCord83);

when I project the point I am getting result as NaN. But It's equivalent DMS should be 42 21' 58.42'', 107 52' 29.28'' and map point should be 42.5698, -107.5229

Please help me how to resolve it.

Thanks, Uday

4
  • NaN means Not a Number so I guess you have error somewhere in your statement. Try debug your middle results and see what is causing the error.
    – Krystian
    Feb 26, 2013 at 14:26
  • 1
    Try switching the northing, easting in the point to easting, northing order. There should also be a transformation but let's get rid of the NaN first.
    – mkennedy
    Feb 26, 2013 at 17:39
  • It is working perfectly. Thankyou verymuch. Thanks, Uday
    – user14628
    Feb 27, 2013 at 11:52
  • Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful.
    – Zachary
    Feb 27, 2013 at 13:37

1 Answer 1

5

The webMercatorToGeographic function is a shortcut way to convert wkid 102100 (web mercator) to wkid 4326 (lat long). You'll need to use a GeometryService to reproject your point, since you're using a different spatial reference.

m_mapPoint[0] = new esri.geometry.Point(4804172, 753352, new esri.SpatialReference({ wkid: 26712 }));
var params = new esri.tasks.ProjectParameters();
// add array of points
params.geometries = m_mapPoint; 
// Output Spatial Reference in lat/long (wkid 4326)
params.outSR = new esri.SpatialReference({wkid: 4326});
// run callback once the geometry service returns the reprojected results.
gsvc.project(params, callback, errback);
1
  • 1
    +1 for this. Don't use webMercatorToGeographic if your source is in NAD27. At that lat/long, your coordinates will be shifted by ~50 meters at the least.
    – Mintx
    Feb 27, 2013 at 17:13

Your Answer

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

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