question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Leaflet tries to get negative value images or images that don't exist

See original GitHub issue

Here is my Leaflet config:

function init() {
    var mapMinZoom = 2;
    var mapMaxZoom = 5;
    var map = L.map('map', {
        maxZoom: mapMaxZoom,
        minZoom: mapMinZoom,
        crs: L.CRS.Simple
    }).setView([0, 0], mapMaxZoom);

    var mapBounds = new L.LatLngBounds(
        map.unproject([0, 4352], mapMaxZoom),
        map.unproject([2048, 0], mapMaxZoom));

    map.fitBounds(mapBounds);
    L.tileLayer('/assets/themes/sec/img/tiles/{z}/{x}/{y}.png', {
        minZoom: mapMinZoom,
        maxZoom: mapMaxZoom,
        bounds: mapBounds,
        noWrap: true,
        continuousWorld: true
    }).addTo(map);

    var store_marker = L.marker([0, 0]).addTo(map);
}

Everything works, but I get a lot of “resource not found” in my console whenever I zoom or pan:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (0.png, line 0)
http://localhost:3000/assets/themes/sec/img/tiles/2/-1/0.png

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (0.png, line 0)
http://localhost:3000/assets/themes/sec/img/tiles/2/1/0.png

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (1.png, line 0)
http://localhost:3000/assets/themes/sec/img/tiles/2/-1/1.png

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (1.png, line 0)
http://localhost:3000/assets/themes/sec/img/tiles/2/1/1.png

I have no negative numbered tiles. The files referenced here don’t exist. Yet everything looks fine on the map. I used MapTiler to build the map. Anything I can do to fix this?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

7reactions
IvanSanchezcommented, May 3, 2017

@josephrocca If you specify the noWrap option, and not the bounds option for the tilelayer, then this is behaviour as expected.

1reaction
mikila85commented, Feb 6, 2017

i downloaded the latest: Leaflet 1.0.3 and i still see this 404 when i zoom out of map with noWrap because of 0 and negative numbers in the x y z. anyone knows how to solve this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent Leaflet from requesting non-existing custom tiles
It works fine. But for every zoomlevel change leaflet makes a number of(around 20 -30) requests to non existing tiles resulting in "NetworkError ......
Read more >
Is Leaflet a good tool for non-map images? - Stack Overflow
Note that I tried the solution described above, and got all sorts of crazy tiling issues (not merely swapped tiles, but requests for...
Read more >
Documentation - a JavaScript library for interactive maps
Runs the given function fn when the map gets initialized with a view (center and zoom) and at least one layer, or immediately...
Read more >
Information Leaflet on the Care, Handling, and Storage of ...
Cataloging and access tools can support preservation by minimizing the need for researchers to handle original photographs or one-of-a-kind images, including ...
Read more >
50 powerful examples of visual propaganda and the ... - Canva
Try the Blue Photo Hiring Poster template. ... This message implies that if you don't support the war financially, harm could come to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found