Extract better GPS coordinates from images using exiftool

Posted by ads on Thursday, 2023-05-18
Posted in [Software]

Sometimes I have to extract Exif information from images, mostly the GPS coordinates. The coordinates coming raw from the images are not very helpful. Let’s look at a picture I took today:

Bowl of ice cream
Bowl of ice cream

darktable shows the following coordinates:

latitude: N 52° 40,198'
longitude: E 013° 16,852'
elevation: 93,90 m above sea level

Now that is not very helpful, because neither OpenStreetMap nor Google recognize this format out of the box:

N 52° 40,198' E 013° 16,852'

Coordinates not working in OpenStreetMap
Coordinates not working in OpenStreetMap

Coordinates not working in Google
Coordinates not working in Google

Bummer. And I don’t have the time or energy to fix that every time I need the coordinates. Luckily exiftool can output the coordinates in different formats, which is super helpful. For my use cases I choose the Degrees.MinutesSeconds format, also named “Decimal degrees”, or DD. This format shows latitude and longitude geographic coordinates as decimal fractions of a degree.

1
exiftool -time:all -location:all -G -a -s -c "%.6f"

The explanation for the options used here:

  • -G: Print group name for each tag
  • -a: Allow duplicate tags to be extracted
  • -s: Short output format
  • -v: Print verbose messages
  • -q: Quiet processing
  • -c "%.6f": Set format for GPS coordinates

Using these settings, I get the following coordinates:

[Composite]     GPSAltitude                     : 93.9 m Above Sea Level
[Composite]     GPSLatitude                     : 52.669959 N
[Composite]     GPSLongitude                    : 13.280862 E
[Composite]     GPSPosition                     : 52.669959 N, 13.280862 E

Which sure enough brings me right to the ice cream place “Il Pistacchio” in Hohen Neuendorf, which I visited earlier today.

Il Pistacchio on OpenStreetMap
Il Pistacchio on OpenStreetMap


Categories: [Software]

Share: