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

_points_equal incorrectly compares floats with is not #19

Open
craigds opened this issue Jul 14, 2020 · 1 comment · May be fixed by craigds/vector-tile-base#1
Open

_points_equal incorrectly compares floats with is not #19

craigds opened this issue Jul 14, 2020 · 1 comment · May be fixed by craigds/vector-tile-base#1

Comments

@craigds
Copy link

craigds commented Jul 14, 2020

I noticed add_ring is not treating my closed ring like a closed ring:

ipdb> pt1
(19188372.37109346, -5402212.477493137)
ipdb> pt2
(19188372.37109346, -5402212.477493137)
ipdb> n
> /Users/cdestigter/checkout/sno/sno/pyvendor/vector_tile_base/engine.py(314)_points_equal()
    313         if pt1[0] is not pt2[0] or pt1[1] is not pt2[1] or (self._has_elevation and pt1[2] is not pt2[2]):
--> 314             return False
    315         return True

ipdb> pt1[0] == pt2[0]
True
ipdb> pt1[0] is pt2[0]
False

is not isn't the appropriate comparator here, it shoudl be !=. python doesn't guarantee two equal floats are the same float.

craigds added a commit to craigds/vector-tile-base that referenced this issue Jul 14, 2020
@craigds craigds linked a pull request Jul 14, 2020 that will close this issue
@pumelo
Copy link

pumelo commented Dec 17, 2021

As I understand, within an mvt the coordinates are all ints, no?

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

Successfully merging a pull request may close this issue.

2 participants