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

Increase precision of GpsDegrees.Raw() #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions v3/gps.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ func (d GpsDegrees) Decimal() float64 {
return decimal
}

// Raw returns a Rational struct that can be used to *write* coordinates. In
// practice, the denominator are typically (1) in the original EXIF data, and,
// that being the case, this will best preserve precision.
// Raw returns a slice of Rationals that can be used to *write* coordinates. The
// conversion uses a denominator of 1 for degrees and minutes and 1000 for
// seconds. These denominators are not necessarily the same as the original
// data, but they will provide a precision of about an inch at the equator.
func (d GpsDegrees) Raw() []exifcommon.Rational {
return []exifcommon.Rational{
{Numerator: uint32(d.Degrees), Denominator: 1},
{Numerator: uint32(d.Minutes), Denominator: 1},
{Numerator: uint32(d.Seconds), Denominator: 1},
{Numerator: uint32(d.Seconds * 1000.0), Denominator: 1000},
}
}

Expand Down