Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector Tiles don't scale up smoothly with Canvas renderer #164

Open
Excape opened this issue May 24, 2018 · 1 comment
Open

Vector Tiles don't scale up smoothly with Canvas renderer #164

Excape opened this issue May 24, 2018 · 1 comment

Comments

@Excape
Copy link

Excape commented May 24, 2018

I'm using vector tiles that go up to zoom level 13, so i set the maxNativeZoom to 13.
When i allow a maxZoom higher than that, e.g. 17, the layer should scale up.

With rendererFactory: L.svg.tile, this works fine:
image

This slower in performance than L.canvas.tile however. With that however, the scaled-up version looks blurry:
image

BTW, I'm using the [ react-leaflet ](https://github.com/PaulLeCam/react-leaflet plugin) plugin with a custom component where i call leaflet directly, like in this issue

Is there some inherent reason how canvas gets rendered, or is that an issue with the canvas renderer?

@IvanSanchez
Copy link
Member

I think this is behaviour as expected. If you use a maxZoom higher than maxNativeZoom on any L.TileLayer, the image will appear pixellated in the same fashion.

Is there some inherent reason how canvas gets rendered, or ...?

This is how <canvas>es work. Leaflet's L.Canvas renderer rasterizes the vector data into pixels.

You could argue "but it might be better to re-rasterize the <canvas> tiles on zoom change, doubling up their (width and height) size at each zoom threshold", to which I would reply "yeah, but that's extra work, and doubling up the size of canvases might create canvases larger than the screen and too large for the GPU, so if you want to re-rasterize stuff at zoom thresholds you will be better setting up a higher maxNativeZoom value anyway".

I'm partial to closing this as "it's a feature, not a bug". I don't think there's anything valuable to be done about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants