How to Caluculate Lat/Lon from Polar Stereo Maps

2269
2
04-10-2012 12:36 AM
NaomichiKUWAHARA
Esri Contributor
I would like to know that how to implementation to show the Latitude and Longiitude with mouse move on north-polar stereo map (WKID : 102018) and south-polar stereo map (WKID : 102021) other than calling a geometry service.

I have tried the below code, but can't get correct value.
Please teach me a correct expression.

        private void map1_MouseMove(object sender, MouseEventArgs e)
        {
            if (map1.SpatialReference.WKID == 102018)
            {
                System.Windows.Point screenPoint = e.GetPosition(map1);
                MapPoint mapPoint = map1.ScreenToMap(screenPoint);

                Double p = Math.Sqrt((mapPoint.Y * mapPoint.Y) + (mapPoint.X * mapPoint.X));
                Double lat = Math.Acos(mapPoint.X / p);
                lat = lat * 180 / Math.PI + 90;

                Double lon = Math.PI / 2 - Math.Atan(p / (2 * 6378.137 * 1000));
                lon = lon * 180 / Math.PI / 2;

                LatitudeTextBlock.Text = string.Format("Latitude: Y = {0}", lat);
                LongiitudeTextBlock.Text = string.Format("Longiitude: X = {0}", lon);
            }
        }
0 Kudos
2 Replies
ChrisBradberry
Occasional Contributor
It would be much easier to use the geometry service to project the coordinates.

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MouseCoords

That gives you the coordinates, and you will have to add some code to project the coordinates using:

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project

Chris
0 Kudos
NaomichiKUWAHARA
Esri Contributor
Thank you for comment.
Your method is much easier, however it is a little bit heavy to show the Latitude and Longitude with mouse move at all time.
I would like to consider to use the geometry service.

Thanks!
0 Kudos