0
votes

I have an app that allows users to search a location and zoom on a map, mostly remote locations where satellite images are not available for higher zoom levels. This causes the map to often request missing tiles that show as blank images. Is there a way to check and stop the zoom so that the map does not ask for/load these blank tiles?

I know how to show a custom missing tile, but I am trying to avoid the need to use it by blocking the zoom.

Thanks,

1

1 Answers

-1
votes

One approach that you could try is trying to pre-load tiles. The approach is to listen to map bounds change, and when that happens you can try to load the tiles for the zoom levels around your current.

You can do this by creating a TileLayer and requesting tiles, which come in the form:

http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}

where z is the zoom, and x and y are tile coordinates.

You can listen to tile loading events and when a tile is loaded, request tiles for different zooms. Based on if these work, you can allow or not allow the user to zoom.

Alternatively, if you know your tile set availability before hand, you can just restrict movement based on a white list of tile coordinates.