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.