Closed Mohamed-Kassem-com closed 3 years ago
I unfortunately have the same problem have you found a solution for this?
You need to set bounds for the layer
const size = [
3831, // original width of image
3101 // original height of image
];
const rc = new L.RasterCoords(map, size);
L.tileLayer('./tiles/{z}/{x}/{y}.png', {
noWrap: true,
bounds: getMaxBounds(rc, size[0], size[1]),
...
})
function to calculate bounds
getMaxBounds(rc, width, height) {
const southWest = rc.unproject([0, height]);
const northEast = rc.unproject([width, 0]);
return new L.LatLngBounds(southWest, northEast);
}
Proposed changes are part of v1.0.4 Credits go to @takvol :clap:
Hi @commenthol and thanks for this plugin.
If you visit https://commenthol.github.io/leaflet-rastercoords/example/index.html and zoom out, you will get a lot of 404 errors in the network panel. Why these errors are happening?
Why is it requesting non-existing images/tile images?
I recorded this video to show you the issue: https://www.dropbox.com/s/prjp7e3cxikijx6/uqHLiG4HyA.mp4?dl=0