Trying to automate renaming/sorting of thousands of images when every camera/phone has its own idea of where to put UTC and local time.
I rename the files based on DateTimeOriginal, so when that is not there, I set it from something else.
But every time I run my script to update a group of images/videos, I find a new method. Sometimes this means that the tag I was using to copy local time into DateTimeOriginal contains instead UTC or even some useless time like when someone cropped the image.
Some of the photos my sister took in Europe on a Microsoft Surface with "local" time still in Denver, Colorado.
Is there a shell script method to get the time zone offset from the lat/long and then use it with GPSDateTime to set DateTimeOriginal to local time?
Google has an API to convert GPS coordinates to time zone (https://developers.google.com/maps/documentation/timezone/overview), but you will need an API key to use it.
I also found this StackOverflow answer (https://stackoverflow.com/questions/16086962/how-to-get-a-time-zone-from-a-location-using-latitude-and-longitude-coordinates)
- Phil
Yeah, I saw that SO item (and several others). Unfortunately, an API can't be used off-line and is awkward to put in a shell script. Several others might work, but I'd have to learn the language they're in to find out.
Part of the problem with an offline solution is that time zones are always changing. And as usual, I'll take this opportunity to post my favorite Tom Scott video
The Problem with Time & Timezones - Computerphile (https://www.youtube.com/watch?v=-5wpm-gesOY)
Yes, time zone change (and daylight savings dates), but knowing the current time zone for a location will be correct often enough for me. But I see that my recent photos have neither GPSDateTime nor GPSTimeStamp. They do have OffsetTime, which can be subtracted from DateTimeOriginal to get GPSDateTime—except when DateTimeOriginal is missing!