jokiazhang / metadata-extractor

Automatically exported from code.google.com/p/metadata-extractor
0 stars 0 forks source link

GPS location parsing doesn't handle NaN values #84

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
metadata-extractor fails to parse the GPS location from an image produced by 
the Nikon D5000 (using the getGeoLocation() method in GpsDirectory). JOSM works 
around this issue by detecting NaN values in the arrays associated with 
TAG_GPS_LONGITUDE and TAG_GPS_LATITUDE.

Here is a sample image:

http://josm.openstreetmap.de/raw-attachment/ticket/6162/a.jpg

And the bug report that addressed this issue for JOSM:

http://josm.openstreetmap.de/ticket/6162

This is how JOSM converts the coordinates:

    Rational[] components = dirGps.getRationalArray(GpsDirectory.TAG_GPS_LONGITUDE);

    double deg = components[0].doubleValue();
    double min = components[1].doubleValue();
    double sec = components[2].doubleValue();

    if (Double.isNaN(deg) && Double.isNaN(min) && Double.isNaN(sec))
        throw new IllegalArgumentException();

    double lon = (Double.isNaN(deg) ? 0 : deg
               + (Double.isNaN(min) ? 0 : (min / 60))
               + (Double.isNaN(sec) ? 0 : (sec / 3600)));

Original issue reported on code.google.com by emmanuel...@gmail.com on 23 Jul 2013 at 9:35

GoogleCodeExporter commented 8 years ago
This issue has been migrated along with the project to GitHub:

https://github.com/drewnoakes/metadata-extractor/issues/15

A new release with this fix will be made in the first week of December.

Original comment by drewnoakes on 19 Nov 2014 at 5:55

GoogleCodeExporter commented 8 years ago
Fixed in:

https://github.com/drewnoakes/metadata-extractor/commit/4e79759cb3efee4682f8cf53
ca450e6639631baa

Thanks for the bug report!

Original comment by drewnoakes on 19 Nov 2014 at 9:38