PMTiles icon indicating copy to clipboard operation
PMTiles copied to clipboard

noWrap option not working on pmTiles

Open haax opened this issue 2 years ago • 1 comments

Hi In leaflet it's possible to set a noWrap option to not repeat the tileset when zooming out.

const tiles = L.tileLayer("output_dir/{z}/{x}/{y}.png", {
      noWrap: true,
      attribution:
      '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      .addTo(map);

This does not work on pmTiles. Is it not implemented or is it done in some other way?

haax avatar Apr 18 '23 06:04 haax

Are you using it in conjunction with bounds?

pmtiles.leafletRasterLayer(p, {
   noWrap: true,
   bounds: L.latLngBounds(L.latLng(-85,-180), L.latLng(85, 180)),
...

Without bounds Leaflet will request unwrapped tile coordinates such as z=0 x=1 y=0 which many ZXY endpoints will fail for.

Since PMTiles only supports tile pyramids where Z=0 has 1 tile, etc, we could add our own coordinate wrapping, but for now the behavior remains the same as plain tileLayer.

bdon avatar Apr 19 '23 09:04 bdon

See answer on https://stackoverflow.com/a/47482145 on how to use noWrap in conjunction with bounds.

bdon avatar Sep 11 '24 07:09 bdon