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

GPS conversion error with Python Fraction for rational 64 output #106

Open
apiszcz opened this issue Aug 11, 2020 · 1 comment
Open

GPS conversion error with Python Fraction for rational 64 output #106

apiszcz opened this issue Aug 11, 2020 · 1 comment

Comments

@apiszcz
Copy link

apiszcz commented Aug 11, 2020

This line in in _dump.py
new_value += (struct.pack(">L", num) +

is failing with large rational integer outputs of Python Fraction
Fraction(2476979795053773, 2251799813685248)

Is there a better way to generate the rational fraction the GPS lat, lon require?

@sthi0460
Copy link

I was running into this issue a few days ago as well. I realized that I could not use rational numbers representing geo-coords in the decimal degrees format for a couple of reasons. I converted decimal degrees into three separate rational numbers for the hours, minutes, and seconds. The rational numbers for hours and minutes are all of the form "(some_integer, 1)," while the seconds rational numbers are "(some_integer, some_integer)." I am finding with the accuracy required for my project, all "seconds" rational numbers can be represented by 32-bit numbers.
Looking at the EXIF standard documentation, GPS coordinated are required to be in the (hours_rational, minutes_rational, seconds_rational) format anyway, with all numbers 32-bit. It is possible that Piexif is written to accept 64-bit decimal degree coordinates and I was encountering another error entirely. But, I was able to successfully add lat/lon to images using the above method.

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