Get distance of MapControl border in degrees


I have a MapControl and would like to know how many degrees are currently shown on the x and y axes.

First example: <a href="https://i.stack.imgur.com/OiyKp.png" rel="nofollow"><img alt="map landscape" class="b-lazy" data-src="https://i.stack.imgur.com/OiyKp.png" data-original="https://i.stack.imgur.com/OiyKp.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

360 degrees are shown on the x axis (longitude)

~90 degrees are shown on the y axis (latitude)

(The zoom level is 3.2 and it's max zoomed out)

Second example: <a href="https://i.stack.imgur.com/atwsH.png" rel="nofollow"><img alt="map portrait" class="b-lazy" data-src="https://i.stack.imgur.com/atwsH.png" data-original="https://i.stack.imgur.com/atwsH.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

~220 degrees on the x axis (longitude)

180 degrees on the y axis (latitude)

(zoom level: 1.7; max zoomed out)

I tried calculating the current degrees on the x axis using following code:

double dist = 360 * Math.Pow(0.5, macSurrounding.ZoomLevel - 1);

but it doesn't work, because the zoom level is just strange...


You should use the MapControl's <a href="https://msdn.microsoft.com/de-de/library/windows/apps/windows.ui.xaml.controls.maps.mapcontrol.getlocationfromoffset.aspx" rel="nofollow">GetLocationFromOffset</a> method to calculate the geographic coordinates of the south-east and north-west corner points of the current map viewport. The width and height of the viewport would be the latitude and longitude differences of these points.

Geopoint northEast; Geopoint southWest; map.GetLocationFromOffset(new Point(map.ActualWidth, 0), out northEast); map.GetLocationFromOffset(new Point(0, map.ActualHeight), out southWest); var width = northEast.Position.Longitude - southWest.Position.Longitude; var height = northEast.Position.Latitude - southWest.Position.Latitude;


Got it:


360 * Math.Pow(0.5, mcMapControl.ZoomLevel - 1) * mcMapControl.ActualWidth / 409.5;


180 * Math.Pow(0.5, mcMapControl.ZoomLevel - 1) * mcMapControl.ActualHeight / 409.5;


  • Regex to capture float from string (and replace with the captured float)
  • Adding Conditionals & Functions to a Math Parser
  • Round number to nearest “nth” based on first non zero
  • (C++/win32) Hide a window so that the user cannot alt-tab or switch to it
  • Strange multiple assignment error in C++
  • How to store result of stored procedure in a variable using SQL Server
  • How to insert data into a Microsoft Access Database?
  • C++ development on linux Code::Blocks, EMACS or GVIM [closed]
  • javafx 3d performance large data set
  • Python 2.7 on OS X: TypeError: 'frozenset' object is not callable on each command
  • ggplot2 polygon world map centred with limits gives funny edges
  • HTTP Module intercept requests and breaks custom errors configuration
  • Differences between drawing an Ellipse in Android and Java
  • JSON data through JS/AJAX into PHP
  • Correctly Importing Apache Commons Math Package
  • Cryptic error when trying to run POW
  • Using Netbeans with Cygwin and SDL, including SDL.h creates strange error
  • Python 3.2.2, error(scripts to exe)
  • C# fibonacci function returning errors
  • D3 get axis values on zoom event
  • error importing numpy
  • Use of this Javascript
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Linq Objects Group By & Sum
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How to format a variable of double type
  • Comma separated Values
  • PHP: When would you need the self:: keyword?
  • Buffer size for converting unsigned long to string
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • reshape alternating columns in less time and using less memory
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • How to load view controller without button in storyboard?