maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
888 stars 273 forks source link

Tiles not loading outside of metadata bounds #2521

Open nnhubbard opened 2 weeks ago

nnhubbard commented 2 weeks ago

Fixes issue #1318 where tiles outside of metadata bounds are not loading. This fix allows over zooming so that map features that are not on higher zoom levels will still show from their lower zoom level tiles.

For example, the offline mbtiles file might include world tiles in z1 only, but when you zoom in farther those tiles are blank unless you move to the metadata bounds. With this fix, if you zoom into an area outside of the bounds you will get over zoom from z1 which makes for a much nicer looking map without blank tiles.

wipfli commented 1 week ago

Thanks for working on this. The behavior you describe sounds like the correct one, i.e., only show data from inside the bounds.

@louwers you might want to coordinate with @HarelM on how this behavior is done in MapLibre GL JS.

louwers commented 1 week ago

@wipfli Does MapLibre GL JS support reading local MBTiles?

wipfli commented 1 week ago

MapLibre GL JS does not have offline mbtiles support. My think is that independent of the source - be it an offline mbtiles file or a zxy http endpoint - the behavior for unavailable tiles should be the same.

nnhubbard commented 1 week ago

openmaptiles, which many people use to create offline mbtiles files will create a a world tile at z1 where you can see all continents, countries, etc. It makes sense to continue to show these as you zoom into different parts of the world using over zoom. Without that, an mbtiles file would need to be created with world data on every other zoom level making the file significantly larger.

nnhubbard commented 1 week ago

I don't understand why your changes implements the behavior you say it does. Could you explain it?

This small code change will, when receiving an error for no tile, instead allow the previous zooms tile to show instead of showing blank. E.g. overzoom.