Mapbox gl: refer to different tile sources with different zoom levels

Viewed 129

I'm coding a map and I have the following raster source:

{ 
  type: 'raster',
  tiles: [
       LinkA,
       LinkB
  ],
  tileSize: 256,
  scheme: 'tms' 

}

I want to switch to LinkB from a certain zoom level, how can I do that?

1 Answers

I don't think there's a way to do that within one source.

But you could create two sources, each with a different minzoom and maxzoom, and one layer for each. The end result should be pretty similar.

EDIT

For completeness, I think it would be possible to use transformRequest to modify the URL when a request is made, within a single raster source. A more complicated solution though.

Related