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

Lat and Long are unpacked incorrectly #3

Open
que5o opened this issue Jan 4, 2022 · 0 comments · May be fixed by #7
Open

Lat and Long are unpacked incorrectly #3

que5o opened this issue Jan 4, 2022 · 0 comments · May be fixed by #7

Comments

@que5o
Copy link

que5o commented Jan 4, 2022

Your code in the __decode_tag function does not properly unpack the coordinate data. Your code is not properly handling the sign of, e.g. longitude, so I was getting longitudes >180 where they should be negative instead. I made the below fix that solved my problem.

#current incorrect code
latitude = int.from_bytes(data[0:4], 'big', signed=True) / 10000000.0
longitude = int.from_bytes(data[4:8], 'big', signed=True) / 10000000.0

#correct
latitude = struct.unpack('>i',data[0:4])[0] / 10000000.0
longitude = struct.unpack('>i',data[4:8])[0] / 10000000.0

I know these both look like they should do the same thing, but they apparently do not. I was getting bad data until I updated these lines.

Philip2809 added a commit to Philip2809/openhaystack-python that referenced this issue Nov 19, 2024
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.

1 participant