Reputation: 25
I am working on a GL project which is a conversion from Leaflet. Under Leaflet when we set a tile bounds (maxbounds limit of view) it was possible to render a default or error tile image when you are outside of the max bounds. So in may case I would render a tile which stated showed a message stating the selected data was only available for Australia (or whatever country/region).
In leaflet this is called: errorTileUrl String '' URL to the tile image to show in place of the tile that failed to load.
This meant I did not have to have blank/msg image tiles loaded into the tile server. Is this at all possible with the MapBox GL system.
Here is the style I am using:
style: {
"version": 8,
"sources": {
"Tiles": {
"type": "raster",
"tiles": ["https://myprivate server/{z}/{x}/{y}.png"],
"tileSize": 256
}
},
"layers": [{
"id": "Tiles",
"type": "raster",
"source": "Tiles",
"minzoom": 0,
"maxzoom": 13
}],
"sprite": "mapbox://sprites/mapbox/outdoors-v9",
"glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf"
},
I still want to be able to view the world just send out a blank/default tile when there is a http download error with the requested tile. At the moment it renders a white square and gives a console error for the failed download.
Upvotes: 0
Views: 1616
Reputation: 3802
This is not yet possible in GL JS. We are tracking the implementation of TileJSON's maxBounds
at https://github.com/mapbox/mapbox-gl-js/issues/1775
Depending on your use case, you may be able to implement this feature downstream by adding features in response to the tile.error
event or by adding a layer beneath your raster layer which displays your desired loading / errored texture.
Upvotes: 0