need help to change output coordinates format

Started by Astrophytum, February 20, 2023, 01:34:28 AM

Previous topic - Next topic

Astrophytum

Hello,

first, many thanks to Phil for the years of work!


Some years ago, Phil helped me with right syntax for exiftool.

Now, I have the next little problem.

I use exiftool to create a csv-file from all pictures into a folder, that contains filename, longitude and latitude.

Here the Code, working very well:

chcp 1252
exiftool -q -q -echo "Filename;GPSLatitude;GPSLongitude" -p "$filename;${gpslatitude;s/(.*) ([NSEW])$/$2$1/};${gpslongitude;s/(.*) ([NSEW])$/$2$1/}" -c "%%d° %%.3f'" "." "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\*.jpg" Koordinaten_aus_Photos.csv > "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\Pilze-Koordinaten.csv"

Output is:
Picture-name.jpg  N50° 32.821'    E12° 3.326'

Now I will change the output coordinate-format.
From N50° 32.821' E12° 3.326' to 50.547017, 12.055433

And here is my problem. I tried format the coordinates -c "%.6f"

New Code:

chcp 1252
exiftool -q -q -echo "Filename;GPSLatitude;GPSLongitude" -p "$filename;${gpslatitude;s/(.*) ([NSEW])$/$2$1/};${gpslongitude;s/(.*) ([NSEW])$/$2$1/}" -c "%.6f" "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\*.jpg" Koordinaten_aus_Photos.csv > "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\Pilze-Koordinaten.csv"

But the result is:
Picture-name    N.6f    E.6f

Please, can you help me to fix the problem?


Thank you very much,
Kind Regards,
Astrophytum



Astrophytum

#1
Hello,

well, I found my mistake, here the working code:

chcp 1252
exiftool -q -q -echo "Dateiname;Breitengrad;Längengrad" -p "$filename;${gpslatitude;s/(.*) ([NSEW])$/$2$1/};${gpslongitude;s/(.*) ([NSEW])$/$2$1/}" -c "%%.6f" "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\*.jpg" Koordinaten_aus_Photos.csv > "\\SERVER-SCHMIDT\SSD-Master\Pilze\Pilze Koordinaten auslesen\Pilze-Koordinaten.csv"

Kind Regards,
Astrophytum

Phil Harvey

You didn't say you were running from inside a .bat file, but that was the problem.  Percent characters are special in a .bat file and need to be doubled in exiftool commands to pass through the .bat file processing.  This is FAQ 27.

- 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 ($).

Astrophytum

Hello Phil,

yes, you are right, I forgot to say I am running this from a batch file. Sorry.

Kind Regards,
Steffen