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 value precision loss on writing #103

Open
RudyTheDev opened this issue Aug 9, 2022 · 0 comments
Open

GPS value precision loss on writing #103

RudyTheDev opened this issue Aug 9, 2022 · 0 comments

Comments

@RudyTheDev
Copy link

The process for writing GPS values does not preserve sufficient precision of (sub-meter) GPS coordinates. That is, myFile.Properties.Set(new GPSLatitudeLongitude(ExifTag.GPSLatitude, d, m, s)); results in slightly inaccurate "jagged" coordinates, which becomes apparent when they are otherwise smooth/linear/interpolated.

This is what I would expect (these are linearly-generated points at 0.00001/0.00002 lat/lon steps):

expected

This is the actual result:

actual

After investigating, I believe it is UFraction32.FromDouble() that can create an inaccurate fraction. I iterated it a bunch over 0.00001 steps (convert a decimal to fraction and then get back the decimal) and here's the sort of worst case result: 51.409100 -> 51.411765 delta 0.002665. I'm not entirely sure what sort of error this means for DMS seconds vs real-world distance, but the resulting example above shows that it can easily reach a meter or so.

To make sure I wasn't losing precision elsewhere, I changed the decimal-to-fraction implementation to https://stackoverflow.com/a/42085412 and this does indeed result in accurate values (the expected result above is generated this way).

RudyTheDev added a commit to RudyTheDev/exiflibrary that referenced this issue Aug 10, 2022
…nd have GPSLatitudeLongitude use doubles to preserve coordinate accuracy when writing fractional second values. This fixes oozcitak#103 and presumably the cause oozcitak#99.
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

1 participant