leaflet.TileLayer.WMTS
leaflet.TileLayer.WMTS copied to clipboard
tilerow = -Math.round((nw.y - Y0) / tilewidth) computes wrong value for what should result in tilerow=0
When computing tilerow number for the first row, the result of let tilerow = -Math.round((nw.y - Y0) / tilewidth);
is 1 instead of 0 if using too "big" precision for latlng;
I fixed it with using Math.round();
instead.
+1 changed
var tilecol = Math.floor((nw.x - X0) / tilewidth);
var tilerow = -Math.floor((nw.y - Y0) / tilewidth);
to
var tilecol = Math.round((nw.x - X0) / tilewidth);
var tilerow = -Math.round((nw.y - Y0) / tilewidth);