Reputation: 23
I'm building an UWP application and uses the "Windows.UI.Xaml.Controls.Maps.MapControl" from MS.
I would like to show some sort of "ruler" somewhere in the map that gives the user an idea of distance, like in the Bing maps screepclip below:
Any ideas how to achieve this in an UWP app that uses MapControl??
Upvotes: 0
Views: 61
Reputation: 1772
You can use the TryGetLocationFromOffset API https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.maps.mapcontrol.trygetlocationfromoffset?view=winrt-22000 for a couple of screen points to get the lat/long, then use the haversine formula to calculate the great circle distance between the two lat/long https://en.wikipedia.org/wiki/Haversine_formula
Upvotes: 0