Weird coordinates offset when setting GPSLongitude in batch from command-line

Started by xvalen, December 24, 2023, 11:17:12 AM

Previous topic - Next topic

xvalen

So I've finally started the project to GPS'ize my old photos to be able to see them on map.
Tested exiftool with couple of folders, all was fine, now I've created a script that would set location for JPG's, but pulling my hair - it sets GPSLongitude with some weird offset, sending location a bit off in most of the cases  .
I've tried to get latest version of ExifTool, tried to switch from decimal to DMS - same issue.

Is it me doing something stupid or there's issue with exiftool on Windows 10? 

Here's what I am doing for example:
exiftool(-Comment='NiagaraFalls' -charset filename=cp1251 -wm cg -P -GPSLatitude='43 4 44.277' -GPSLongitude='-79 4 44.31' -GpsLongitudeRef=W -overwrite_original).exe

And I end up with DMS 43° 4′ 44.27″ N, 78° 55′ 15.68″ W as returned by XnView and other tools.

Surprisingly my usual FastStone viewer does not recognize coordinates set by ExifTool, but it's not a big deal..


Phil Harvey

Try this:

exiftool(-Comment='NiagaraFalls' -charset filename=cp1251 -wm cg -P -GPSLatitude='43 4 44.277' -GPSLongitude='-79 -4 -44.31' -GpsLongitudeRef=W -overwrite_original).exe

I've added a new to FAQ 14 to illustrate this.

..but it would be simpler to specify the coordinates in +-DD.DDDDDD format.

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

xvalen

Thank you very much, this worked!
I've had the same problem with decimal format I believe, that's what made me to convert coordinates to DMS format in the first place.

Overall wasn't easy project, seems to be worth writing a guide / post to share my approach and caveats. And exiftool is the only tool that made it possible with all features supported to make it work🧡 - from setting coordinates, to preserving file_created date and other tags, all in batch

- created txt file with "comment, lat, lon" (the latter two are easy to copy right away from google maps)
- created Python script that would grab each string and create copy of exiftool.exe with generated parameters (ChatGPT to help, I am not a software developer)
- another Python script to temporary convert non-Latin folder names into English symbols only with originals stored in file
- drag and drop entire folders or batches of files(as sometimes you'd have multiple places in one trip/folder) to corresponding executable with right parameters
- run second script to reverse folder name changes
- enjoy

(before enjoy there's copy to Synology photos which I found to be the best to view existing archive on map / timeline, comparing to many opensource solutions like Photoprism or closed source stuff)

StarGeek

Ah, I see now.  I was testing this trying to figure out what happened.  It was using -79°, then adding 4' and 44.31".

But yeah, digital is simpler.  The GPSPosition you added to make it easy to right-click on Google Maps to get and add the coordinates is great.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Quote from: StarGeek on December 24, 2023, 01:35:49 PMThe GPSPosition you added to make it easy to right-click on Google Maps to get and add the coordinates is great.

Yeah, I like using that one myself.

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