Adapted from Metadata-Extractor by Drew Noakes. This project will read the exif headers from a jpeg file and return a GeoTag class with the location and time the photo was taken.
Degrees, Minutes, Seconds are stored as Exif Rational numbers. JpegGeoTagReader correctly reads the two components of the Rational (Numerator and Denominator), but it reads them as Java long values and then divides them. The result is also a long, causing any decimal to be truncated. Either of the values must be cast to a double prior to dividing to prevent the loss of data.
Thank you for this library. Its pretty fast and saved me a lot of trouble coding it myself since ExifTool is so slow to use from Java. It just had this one little bug needing to be worked out.