alexandre-melard / leaflet.TileLayer.WMTS

Add WMTS layering for leaflet
Other
78 stars 84 forks source link

tilerow = -Math.round((nw.y - Y0) / tilewidth) computes wrong value for what should result in tilerow=0 #21

Open zigacernigoj opened 6 years ago

zigacernigoj commented 6 years ago

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.

NickSavin commented 3 years ago

+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);