Many of my map layers are zoomable to zoom level 21, but one of my basemaps is only zoomable to 18. When I zoom past this level with that particular basemap activated, the background goes white.

I'd like to indicate to my user that this is expected behavior and that there's just no data for that zoom level. I'd like to do this by inserting a tile similar to Google Maps's "no data" tile.

Can I set a default error tile in OpenLayers 3?


lets say you have added to your map an OSM layer. you have to asign the 'tileloaderror' listener to the source of your tile layer. But this would not indicate whether thats a problem of the zoom level or for example a network error. It is just indicating that layer could not be loaded.

Check the code

osmLayer.getSource().on('tileloaderror', function(event) {
//replace with your custom action        
alert("could not load tile layer");

you may find the documentation API here. Though it doesnt eplain much

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.