Get zoom level and center of map from points and their distance in meters
Hi, I am not good at math so please help me with this. I have distance in meters and I need to calculate zoom level and center to map from this. How can I do that? I started with this but now I am completly lost:
var sCoord = new GeoCoordinate(startPoint.X, startPoint.Y);
var eCoord = new GeoCoordinate(latitude, longitude);
var distance = sCoord.GetDistanceTo(eCoord);
I don't know math formula for recalculating distance to zoom level of map and then how to get center of map from that points (startPoint, and second point made from lat and lng).
Re: Get zoom level and center of map from points and their distance in meters
Not sure if I understand it correctly... but I'm guessing you just want to be sure that the map zooms in so it will show both coordinates nicely?
If so, you can use the SetView() method of the Map control.
So the code will be
List<GeoCoordinate> geoCoordinates = new List<GeoCoordinate>();
LocationRectangle locationRectangle = LocationRectangle.CreateBoundingRectangle(geoCoordinates);