OSMDroid and Zooming

Noelkman

Member
Licensed User
Longtime User
Hi there!
I just started with Basic4andoid just a few weeks ago and I'm pretty far with my hiking app with offline maps. I'm wondering if the zoom level is not supported in the archive and let's say we zoom in from 15 to 16 the tiles get scaled or interpolated right!?. Isn't it possible to drag the map around with loading the other tiles from the neighborhood with the same level? It seems that it does not load any other tiles then.
Is this a bug or simply not supported so that I have to take care about it programmatically?

Thanks a big bunch!
 

warwound

Expert
Licensed User
Longtime User
It's not a bug - it's just how OSMDroid works...

When you change zoom level it stretches or shrinks the currently displayed tiles and these tiles remain displayed until the tiles for the new zoom level are loaded.
A simple zoom animation effect is acheived.

If you zoom to a level where there are no tiles, the last loaded tiles will stretch or shrink and remain visible but as you've found - panning the map does not cause tiles from a different zoom level to be loaded and stretched or shrunk.

The stretching/shrinking is purely supposed to be an animation effect and not a way to use existing tiles for zoom levels where there are no tiles.

If you're creating an offline tile archive and adding it to the map as a custom tile source you can set the minimum and maximum zoom levels that the archive contains - and the user wil not be able to zoom to levels where there are no archive tiles.

So your options are really to limit the zoom levels or add more tiles to your offline tile archive.

Martin.
 
Upvote 0

Noelkman

Member
Licensed User
Longtime User
Alright,
that clarifies it. Just wanted to make sure I've not overseen anything.

Thomas.
 
Upvote 0

JoeR

Member
Licensed User
Longtime User
I am using an offline tile archive containing only tiles for zoom levels 15 and 16. How can I stop the user from zooming to other levels?

ref: http://www.b4x.com/android/forum/threads/osmdroid-and-zooming.25020/

.....

If you're creating an offline tile archive and adding it to the map as a custom tile source you can set the minimum and maximum zoom levels that the archive contains - and the user wil not be able to zoom to levels where there are no archive tiles.

........

Martin.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
I am using an offline tile archive containing only tiles for zoom levels 15 and 16. How can I stop the user from zooming to other levels?

ref: http://www.b4x.com/android/forum/threads/osmdroid-and-zooming.25020/

Look at this example of using the XYTileSource: http://www.b4x.com/android/forum/threads/osmdroid-mapview-for-b4a-tutorial.16310/page-3#post-96437.

Try to create an XYTileSource for your offline tiles.
Set the desired min and max zoom levels and then use a 'bogus' URL for the tile server, something like "http://localhost/".
Set the XYTileSource name to match the name of the tiles in your offline tile archive.

Now the map should look in the tile archive for tiles first, if it doesn't find the required tiles it will try and fail to get them from localhost.
And your map should limit zooming to the min and max values you used in the XYTileSource Initialize method.

Martin.
 
Upvote 0
Top