Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get BoundingBox of ONLY visible area of map in osmdroid

I am using osmdroid version 4 and I want to have BoundingBox of visible map. It seems that MapView.getBoundingBox method returns bounding box of all tiles that are visible or partially visible. Take a look at this picture:

enter image description here

Black rectangles are tiles, red rectangle with rounded corners is device display.

I want to have only diagonal area shown by green line. What should I do?

like image 493
Ali Behzadian Nejad Avatar asked Sep 13 '25 21:09

Ali Behzadian Nejad


1 Answers

I believe you are mistaken. getBoundingBox() returns the lat/long boundaries of what is visible on the screen. The code will take the pixel x,y value of the two corners and covert that into lat/long and that is what is used. It is not "snapped" to actual map tiles. The result of getBoundingBox() should return the area of the red box.

like image 183
kurtzmarc Avatar answered Sep 15 '25 12:09

kurtzmarc