Closed MehdiSaffar closed 4 years ago
I think that's generally not possible. Overzooming on the fly is easier because you don't have to perform any aggregation on the fly. Other map rendering engines like Mapbox GL similarly support overzooming but not underzooming.
In my experience I've created aggregation tiles ahead of time to serve at lower zooms
Edit: I take that back... I'm not sure how difficult it would be to support underzooming.
@kylebarron I also dont think it wouldnt be hard to support underzooming. The behavior I want is simply this:
viewport.zoom < minZoom ? draw the tiles we have, dont try to fetch anything
viewport.zoom between minZoom and maxZoom ? fetch as usual
viewport.zoom > maxZoom ? fetch tile at size of maxZoom
if such thing cannot be implemented, I guess I'll have to dig into TileLayer and Tileset2D myself.
I think that's not a common use case, which is why it's not implemented... That means that if you zoom to minzoom-ε
and pan, you'll never load new data. That said I don't think it would be too hard to modify TileLayer
to support it
It is not a common case you are right. I'll try myself and see what I can come up with. Thank you
I have posted something similar, I believe at #4373. I proposed a "fix" to the codebase, but it is far from perfect (you'll see the back and forth we had about what I proposed - it doesn't work for zooming that is too quick). I got around this by maintaining a "background image" but I have >0 zoom levels in my use case so generating that static image was simple on the fly.
I have a TileLayer that fetches nodes from my server. I set
minZoom
equal tomaxZoom
otherwise I would be fetching the same nodes but multiple times. It behaves as I want it when my currentzoom
is>= maxZoom
by keeping the tiles in view, but whenzoom < minZoom
they disappear abruptly.Now I know that
TileLayer
is supposed to be used when you have cached tiles of some location with different resolutions etc.. but is there any way to keep the cached tiles visible even whenzoom < minZoom
? I tried zoom = 0 and zoom = null, but then it would try to fetch bigger and bigger areas.Here is a GIF of the behavior I have right now:
Relevant part of the code: