protomaps / protomaps-leaflet

Lightweight vector map rendering + labeling and symbology for Leaflet
https://protomaps.com/docs/frontends/leaflet
BSD 3-Clause "New" or "Revised" License
767 stars 43 forks source link

protomapsL.leafletLayer fetched tiles' {z} === map._zoom - 1 #165

Closed prushforth closed 4 months ago

prushforth commented 4 months ago

I noticed on my own maps that the zoom value of protomapsL.leafletLayer-fetched mvt tiles is 1 level value less than that of the other layers fetched by, say L.TileLayer.

I think this can be seen in this example.

I noticed this when pmtiles were overlayed on top of image tiles from osm that there did seem to be detail missing, which you might expect if the {z}-1 tiles were loading.

bdon commented 4 months ago

This is by design, because by convention a vector tile addresses 512x512 CSS pixels of device screen space, while the Leaflet defaults address 256x256.

prushforth commented 4 months ago

This is by design, because by convention a vector tile addresses 512x512 CSS pixels of device screen space, while the Leaflet defaults address 256x256.

I see, and I don't actually see any LOD difference that can't be ascribed to styling choices between the pmtiles tiles and the osm image tiles. You can tell Leaflet what size your tiles are though.