Skip to content
Advertisement

Mapbox raster tiles disappearing despite setting maxzoom

I use raster tiles in my Mapbox application, which I integrate as follows:

  map.addSource('sourceID', {
    type: 'raster',
    tiles: ['URL_TO_TILES'],
    maxzoom: 22,
    minzoom: 0,
  });

  map.addLayer({
    id: 'layerID',
    type: 'raster',
    source: 'sourceID',
    rasterOpacity: 0.5,
    rasterResampling: 'nearest',
  });

According to the docs, the expected behaviour for maxzoom should be:

Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels.

In my case the tiles just disappear on zoom level 11, although I have set a maxzoom

Is this caused by the tiles from the server or do I need to adjust my Mapbox code?

Advertisement

Answer

You’re most likely misinterpreting the spec.

Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels.

If your tiles are disappearing at zoom 11, it’s most likely that they are not available (on the server that is providing them) at higher zoom levels than 11.

So you should set your maxzoom to 11. The raster tiles will be overzoomed (pixelated) as you zoom further in.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement