[GIS] How to convert NAD 27 to WebMercator in using the ESRI Silverlight API? (C#)

arcgis-silverlight-apiccoordinate system

I am working with the ESRI Silverlight API. I found THIS post in the ESRI forums and THIS OTHER which show how to convert between WGS84 geographic coordinates and WebMercator coordinates. I want to do the same thing but from NAD27 Geographic coordinates to WebMercator. I found the spatial reference for NAD27 at the spatialreference website with the WKID 4267 and changed the code accordingly with the radius of 6378206.4 and degree 0.01745329251994328 respectively. I ended up with this function (in c#):

private MapPoint GeographicToWebMercator(MapPoint point)
{
        double a = point.Y * 0.01745329251994328;
        double y = (6378206.4/2) * Math.Log((1.0 + Math.Sin(a)) / (1.0 - Math.Sin(a)));

        double x = 6378206.4 * (point.X * 0.01745329251994328);
        return new MapPoint(x, y);
}

Unfortunately, my dots are displaced from where they should be. So, this is not working as intended. I was wondering if someone can take a look at it and tell me what is wrong… or if I can do this projection this way to begin with. The function, as is, is not checking for null "point" or any other data just yet. But, please, don't focus on that. I am just interested in the calculation per se.
Thanks!

Best Answer

If you don't mind making a round trip to the server, and you have a 10.1 geometry service available to you, you can use the Esri Rest API Project Geometries operation.

If Transformation is not specified, a search is made through a set of default GeoTransformations. Currently, the following default transformations are used when applicable:

esriSRGeoTransformation_NAD_1927_TO_NAD_1983_NADCON, forward and reverse, WKID=1241

esriSRGeoTransformation_NAD1983_To_WGS1984_1, forward and reverse, WKID=1188

esriSRGeoTransformation_NAD1927_To_WGS1984_4, forward and reverse, WKID=1173