Reputation: 1719
I am currently displaying my location on a map successfully. I have a Geoposition of my location and from this I can get MyGeoPosition.Coordinate.Accuracy which is in metres. I'd like to display this on the map like most mobile mapping applications do to provide context to the quality of the position accuracy. What I'd like to know is the best way to display this. I was planning to draw an ellipse but I don't know how to calculate the width and height of the ellipse from the meteres value and the zoom level of the map. Any ideas would be appreciated.
Upvotes: 2
Views: 955
Reputation: 1794
Look at this "Retrieving current location".
double myAccuracy = ...;
GeoCoordinate myCoordinate = ...;
double metersPerPixels = (Math.Cos(myCoordinate.Latitude * Math.PI / 180) * 2 * Math.PI * 6378137) / (256 * Math.Pow(2, myMap.ZoomLevel));
double radius = myAccuracy / metersPerPixels;
Ellipse ellipse = new Ellipse();
ellipse.Width = radius * 2;
ellipse.Height = radius * 2;
ellipse.Fill = new SolidColorBrush(Color.FromArgb(75, 200, 0, 0));
Upvotes: 4
Reputation: 424
Mmmm... Not sure If this reply is what you want, but: Why don't you draw a colored circle, and change the color (red-yellow-green) and change the color depending a range of meters, for example if accuracy is less than 100 color gren, from 100 to 500 yellow, more than 500 red.
Upvotes: 0