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

Possible Error generating Quadtree for (0,0) quadrant #19

Open
fabioaazevedo opened this issue Dec 17, 2020 · 1 comment
Open

Possible Error generating Quadtree for (0,0) quadrant #19

fabioaazevedo opened this issue Dec 17, 2020 · 1 comment

Comments

@fabioaazevedo
Copy link

Using custom functions with the coordinates:

  • Latitude: 41.14867208811922
  • Longitude: -8.61602783203125
  • Zoom: 1

Gives tiles tms_x and tms_y equal to zero, which is correct.

Then using:
quadtree = Tile.from_tms(tms_x=0,tms_y=0,zoom=1).quad_tree
gives quadtree="2", when it should be 0.

I managed to get the right result by commenting out this line:

tms_y = (2 ** self.zoom - 1) - tms_y

Is this really an error, or am I doing something wrong with the procedure?

Thank you.

@sap-nocops
Copy link

sap-nocops commented Dec 9, 2021

I see an error in calculating the quadkey from latitude longitude.
I wrote a test which fails

@pytest.mark.parametrize("latitude, longitude, zoom, quadkey", [(40.97356, 14.2153, 4, '1220')])
def test_latitude_longitude(latitude, longitude, zoom, quadkey):
    tile = Tile.for_latitude_longitude(latitude=latitude, longitude=longitude, zoom=zoom)
    assert tile.quad_tree == quadkey

It gives 1202 instead of 1220 which is the one I expect.

Weird thing is that if I call the same function with same latitude and longitude but 23 as zoom, the result is 12201010000110133101022 which is correct and as you can see the first 4 digits are 1220, exactly the same as I expect in the test above

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