GPS - Get the location from a txt file

Started by Sunny, October 27, 2024, 04:15:10 AM

Previous topic - Next topic

Sunny

I would like to get the location which is stored in a txt file. This is more convenient for me than typing the parameters into the command.

BAT
exiftool -k -gpsposition="N 50.056078°, E 14.452429°" %1
I would like to get the location from a file
exiftool -k @ gps.txt %1
in gps.txt file is
-gpsposition="N 50.056078°, E 14.452429°"

Is it possible to achieve this somehow?

EDIT:
There is an option to export and import from a CSV file

From the cmd it works
exiftool -csv -gpsposition folder > out.csv
From the bat file it does not work, an empty CSV file is created
exiftool -k -csv -gpsposition %1 > out.csv
 :(

StarGeek

Quote from: Sunny on October 27, 2024, 04:15:10 AMI would like to get the location which is stored in a txt file. This is more convenient for me than typing the parameters into the command.

BAT
exiftool -k -gpsposition="N 50.056078°, E 14.452429°" %1
I would like to get the location from a file
exiftool -k @ gps.txt %1
in gps.txt file is
-gpsposition="N 50.056078°, E 14.452429°"

Is it possible to achieve this somehow?

You would need to change the text file a bit, but otherwise, yes. You would use the -@ (Argfile) option to do so.

You would need to remove the quotes (see FAQ #29, "My options don't work in a -@ ARGFILE") and move the reference direction after the coordinate numbers. Here's an example using S/W to show that the directions are correctly being saved.
C:\>type temp.txt
-gpsposition=50.056078° s, 14.452429° w
C:\>exiftool -P -overwrite_original -@ temp.txt y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -n -gpsposition y:\!temp\Test4.jpg
[Composite]     GPSPosition                     : -50.056078 -14.452429

QuoteEDIT:
There is an option to export and import from a CSV file

From the cmd it works
exiftool -csv -gpsposition folder > out.csv
From the bat file it does not work, an empty CSV file is created
exiftool -k -csv -gpsposition %1 > out.csv

It works here. I also tested it by drag/dropping the file onto temp.bat with the same results.
C:\>type temp.bat
exiftool -k -csv -gpsposition %1 > out.csv
C:\>temp.bat y:\!temp\Test4.jpg

C:\>exiftool -k -csv -gpsposition y:\!temp\Test4.jpg  1>out.csv

C:\>type out.csv
SourceFile,GPSPosition
y:/!temp/Test4.jpg,"50 deg 3' 21.88"" S, 14 deg 27' 8.74"" W"
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Sunny

#2
Quote from: StarGeek on October 27, 2024, 11:08:47 AMYou would need to change the text file a bit, but otherwise, yes. You would use the -@ (Argfile) option to do so.

You would need to remove the quotes (see FAQ #29, "My options don't work in a -@ ARGFILE") and move the reference direction after the coordinate numbers. Here's an example using S/W to show that the directions are correctly being saved.
C:\>type temp.txt
-gpsposition=50.056078° s, 14.452429° w
C:\>exiftool -P -overwrite_original -@ temp.txt y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -n -gpsposition y:\!temp\Test4.jpg
[Composite]    GPSPosition                    : -50.056078 -14.452429


Thank you very much for your good advice, this solution is already working for me  :) As usual, I made a mistake because I used the @ sign alone without - (must be -@:-[
No need to move the reference direction after the coordinate numbers, it works for me as I wrote it, without the quotes of course.
-gpsposition=N 50.056078°, E 14.452429°
Unfortunately, but the bat file does not work for me, after drag/drop the file is not updated. I have no idea why this is happen, it works for you , it should work for me too  :(

2024.10.27 (18.25.16).png




StarGeek

Quote from: Sunny on October 27, 2024, 01:38:22 PMNo need to move the reference direction after the coordinate numbers, it works for me as I wrote it, without the quotes of course.

Only because the directions are North and East. It will not work if the direction is at the front and the directions are South or West.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype