Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zigacernigoj opened this issue Jul 10, 2018 · 1 comment

Comments

@zigacernigoj
Copy link

zigacernigoj commented Jul 10, 2018

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.

@zigacernigoj zigacernigoj changed the title Math.fllo tilerow = -Math.round((nw.y - Y0) / tilewidth) returns wrong value for what should result in tilerow=0 Jul 10, 2018
@zigacernigoj zigacernigoj changed the title tilerow = -Math.round((nw.y - Y0) / tilewidth) returns wrong value for what should result in tilerow=0 tilerow = -Math.round((nw.y - Y0) / tilewidth) computes wrong value for what should result in tilerow=0 Jul 10, 2018
@NickSavin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants