Print GPS coordinates with 10 decimal degrees

Started by Fulco, April 03, 2016, 05:42:27 AM

Previous topic - Next topic

Fulco

To print GPS coordinates in QuickTime format I run this command:

iMac-van-Fulco:~ Fulco$ exiftool -n -p '+$GPSlatitude+00$GPSlongitude' /Users/Fulco/Pictures/20160218135416.jpeg
+48.8628056091722+002.34275861210278


How can I get a result with 10 instead of 13 decimal degrees?

- Fulco

Fulco

In my first question I didn't pay attention to the possibility of a minus (south or west) sign in the longitude coordinate. I tried another command, but can't figure out how to get no, one or two zero's behind the plus or minus sign in this coordinate. Is that possible?

iMac-van-Fulco:~ Fulco$ exiftool -m -c "%+.10f" -p '$GPSlatitude$GPSlongitude' /Users/Fulco/Pictures/20150415123456.NEF /Users/Fulco/Pictures/20150812201123.NEF /Users/Fulco/Pictures/20160112105401.NEF /Users/Fulco/Pictures/20160218135416.NEF
-6.2214065933+106.8347024918
+48.8628056092+2.3427586121
+38.7252288092-9.1500234604
-22.9122703478-43.2300424576


- Fulco

Phil Harvey

One way would be this:

-c %+.10f -p '$gpslatitude${gpslongitude;s/([-+])/$1.("0"x(15-length $_))/e}'

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Fulco

Thank you! Is possible to place one or no zero behind the plus or minus sign in the latitue coordinate as well? For exemple: +09.3992890000-084.1540720000

- Fulco

Fulco

I found out by myself: exiftool -c %+.10f -p '${gpslatitude;s/([-+])/$1.("0"x(14-length $_))/e}${gpslongitude;s/([-+])/$1.("0"x(15-length $_))/e}'

Thank you!

- Fulco