I have created custom tiles using TileMill
. extracted tiles as png images and adding them on base layer. using following code
var venu_map = new L.tileLayer('static/b18/{z}/{x}/{y}.png', {
maxZoom:22,
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
It works fine. But for every zoomlevel change leaflet makes a number of(around 20 -30) requests to non existing tiles resulting in "NetworkError: 404 NOT FOUND
. Complete error msg is "NetworkError: 404 NOT FOUND - http://127.0.0.1:8000/static/b18/16/47372/30375.png"
. The particular image does not exist. Even after setting maxbounds
this error show up. Any solutions?
Best Answer
Setting
bounds
for the layer solves the problem. Becauseleaflet
will not try to fetchtiles
out of the specifiedbounds