2 Replies Latest reply on Apr 11, 2012 8:11 PM by naomichi_kuwaharaesrij-esridist

    How to Caluculate Lat/Lon from Polar Stereo Maps

    naomichi_kuwaharaesrij-esridist
      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);
                  }
              }