1

I created custom tiles in TileMill with latitude/longitude boundaries of:

-89.8235,43.3377,-89.5952,43.4741

I added those tiles into the map and set the tile layer's bounds attribute, but Leaflet still is giving me a lot of "Not Found" errors in the console.

Here's my code for adding the tiles:

{
    "parks boundaries": L.tileLayer('data/custom-tiles/boundaries/{z}/{x}/{y}.png', {
           bounds: [[43.3377,-89.8235],[43.4741,-89.5952]]
    }).setOpacity(0.4).addTo(map)
}

Here are some of the errors I'm getting:

GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5994.png 404 (Not Found) 
GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5995.png 404 (Not Found) 
GET http://localhost/cart575final/data/custom-tiles/boundaries/14/4105/5993.png 404 (Not Found)

Why is Leaflet still trying to fetch tiles that don't exist when the bounds of my tiles are clearly stated?

1

I think you are asking the wrong question ...

Leaflet does the right thing: the tiles you see in your errors belong to your boundaries.

To be convinced of it, please have a look at this JSFiddle where your boundaries are shown as a rectangle.

You see that Leaflet only loads the tiles needed and that 14/4105/5993.png is shown

  • My boundaries are pulled directly from the Tilemill file used to create the tiles. Why would Tilemill incorrectly display the boundaries? – CaitlinW Jan 27 '15 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.