Reputation: 85
I created an Android Mobile Application which uses OSMDroid Mapview. It loads perfectly fine from zoom levels below 18. However it only rescales and never serves me tiles from 19 and below.
I have my own tile server using Mapnik, Renderd, Mod_tile so on and so forth. I've set my application to use my own tile server too. Using .../osm_tiles/{zoom}/{x}/{y} I know it goes down to level 20, as I've set. It simply doesn't serve it to my mobile device.
I notice that after a while, the tiles cached on my mobile phone tends to "mix" with some loaded with the default MAPNIK one. Which is causing my map to look weird in certain places.
EDIT: Thanks for all who gave me tips and advice. After deleting and re-downloading the tiles, it's no longer mixed! I didn't see any mixing of names when I looked through my code but I'm pretty sure at some point I must've made the mistake of naming them the same.
It however, still doesn't go below level 18. Here's what I set in my code though:
ITileSource tileSource;
tileSource = new XYTileSource("custom", ResourceProxy.string.mapnik, 16, 20, 256, ".png", custom);
TileSourceFactory.addTileSource(tileSource);
The tiles do go down to 20 upon checking, mod_tile serves them when I access it from the web browser. Looking through the Android Monitor (Using Android Studios Preview 4) I see it downloading and fetching tiles at higher levels but as soon as it goes down to 19, all that stops fetching.
Upvotes: 0
Views: 379
Reputation: 85
Firstly, solved the issue of the mixed tiles by deleting and re-downloading the tiles, it's no longer mixed! I didn't see any mixing of names when I looked through my code but I'm pretty sure at some point I must've made the mistake of naming them the same. Thanks to Spy for pointing it out.
So just plug in the your android phone, look for the folder named "osmdroid" and delete tiles accordingly.
Next, it seems I had forgotten to add the line
mv.setTileSource(TileSourceFactory.getTileSource("private"));
After creating the source and adding it, I need to also set it on my mapview specifically. It previously wasn't going past level 18 and downloading tiles because it was using the default OSM tile source! :)
Upvotes: 0
Reputation: 3258
A few different things going on here.
1) At zoom levels > than the available imagery, osmdroid will scale that last viewed tile (stretch it to make it bigger). This gives the illusion of zooming in and is generally replaced immediately as the new tiles are loaded. It's a feature that's used primarily during the animation inbetween zoom levels. In this case, you're simply not getting level 19+ tiles. When configuring osmdroid for your app, did you tell it that the map source (ITileSource) supports the higher zoom levels? Also, you may want to turn on debugging and watch the logs to see if attempts are made to download the > 18 tiles.
2) Have you confirmed that the tile server really does produce tiles at zoom>18? osmdroid should go up to around 22. It's difficult to test as few map sources provide imagery at that level.
3) Mixed up tiles. When using custom tile sources, always make sure the tile source "Name" that you tell osmdroid is somewhat unique. If you use "MAPNIK" for bing and "MAPNIK" for mapquest, you'll end up with a mismatch of tiles from both sources when viewing either one. The only way to fix it is to clear the tile catch, which is usually /sdcard/osmdroid/tiles/
Upvotes: 1