Retrieving phone current location – encore

I already made a post about this topic. So what? Why I am going to write one more, again? You’ll find that out very soon!

This time we are going to merge the “Location Marker” tips we had from the two previous posts together with the “Phone Current Location” stuff.

Let’s get started!

private void DrawAccuracyRadius(MapLayer mapLayer)
     // The ground resolution (in meters per pixel) varies depending on the level of detail
     // and the latitude at which it’s measured. It can be calculated as follows:
     double metersPerPixels = (Math.Cos(MyCoordinate.Latitude * Math.PI / 180) * 2 * Math.PI * 6378137) / (256 * Math.Pow(2, MyMap.ZoomLevel));
     double radius = _accuracy / metersPerPixels;

     Ellipse ellipse = new Ellipse();
     ellipse.Width = radius * 2;
     ellipse.Height = radius * 2;
     ellipse.Fill = new SolidColorBrush(Color.FromArgb(75, 200, 0, 0));

     MapOverlay overlay = new MapOverlay();
     overlay.Content = ellipse;
     overlay.GeoCoordinate = new GeoCoordinate(MyCoordinate.Latitude, MyCoordinate.Longitude);
     overlay.PositionOrigin = new Point(0.5, 0.5);

Got any question about the above code? To me, it looks about straightforward! Nothing different from previous posts was used to make it. Still, if anything is unclear to you, feel free to post a comment down here and I’ll get back to help you as soon as possible 🙂

Happy coding! 🙂

Un pensiero su “Retrieving phone current location – encore


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.