Esri/esri-leaflet-vector

Repeated tile requests

Closed this issue · 1 comments

Describe the bug

I've only recently started playing with esri-leaflet-vector and I'm confused by the repeated tile requests. I thought I was doing something wrong, but have reduced it to a basic example where there's 8 tile requests with 4 unique ones.

Screenshot 2024-07-31 at 20 09 52

The requests/responses seem to be exactly the same (same Etag).

This seems to be affected by center/zoom/basemap values and I've seen some combinations issuing trice the same tile request.

Is this expecting the responses to be cached and/or the browser to de-dup the requests?

Reproduction

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />

        <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
        <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>

        <script src="https://unpkg.com/esri-leaflet/dist/esri-leaflet.js"></script>
        <script src="https://unpkg.com/esri-leaflet-vector@4/dist/esri-leaflet-vector.js"></script>

        <style>
            #map {
                width: 904px;
                height: 300px;
            }
        </style>
    </head>
    <body>
        <div id="map"></div>
        <script>
            var map = new L.Map('map', {}).setView([46.22, 10.58], 2);

            var tileLayer = L.esri.Vector.vectorBasemapLayer("arcgis/light-gray", {
                token: "XXX",
            }).addTo(map);
        </script>
    </body>
</html>

Logs

No response

System Info

Latest Leaflet/esri-leaflet/esri-leaflet-vector

Additional Information

No response

This is part of the MapLibre functionality to render additional copies of the world when it wraps around the edges of the map. Since you are zoomed out so far it is requesting additional tiles for the end of the world and does not de-duplicate them. If you REALLY want to turn this off you can use:

tileLayer._maplibreGL._glMap.setRenderWorldCopies(false)

https://maplibre.org/maplibre-gl-js/docs/examples/render-world-copies/