# What's the relationship between Level Of Detail and ZoomLevel ?

• ### Question

• What's the relationship between Level of Detail (described at http://msdn.microsoft.com/en-us/library/bb259689.aspx) and Bing.Map.ZoomLevel ie how can I get the map's current level of detail ? I assumed that since with ViewRestriction="MapOnly" the ZoomLevel ranges from 2.5 to 20, Lod would equal (int)(ZoomLevel - 1).

I need to know this relationship to be able to calculate the distance between two points on the map at a given level of detail w/o using Map.TryLocationToPixel(), but using TileSystem.LatLongToPixelXY() instead (to see if two given pins would overlap at a given zoom level).

Tuesday, January 22, 2013 3:08 PM

### All replies

• That documentation is pretty old, thus the confusion, in this case the level of detail is the same thing as zoom level. If you want to calculate the distance between two coordinates on the map you can use the Haversine formula which is much easier and more accurate: http://www.stormconsultancy.co.uk/blog/development/code-snippets/the-haversine-formula-in-c-and-sql/

http://rbrundritt.wordpress.com

• Proposed as answer by Tuesday, January 22, 2013 6:18 PM
• Marked as answer by Wednesday, January 23, 2013 11:57 AM
Tuesday, January 22, 2013 6:18 PM
• Thanks for the quick response. Sorry I wasn't able to respond from home, had some log-in issues.

Yeah, I was confused by the fact that zoom level is a double and level of detail is an integer value. So basically when zoom level is between and 2.0 and 2.9 , level of detail would be 2 and so on ?

I don't need to calculate the distance in kilometers on the map, but rather the distance on screen in pixels at a certain zoom level (for collision detection / pin clustering).

Wednesday, January 23, 2013 7:14 AM
• I would round off the zoom level using Math.Round.

http://rbrundritt.wordpress.com

Wednesday, January 23, 2013 11:32 AM