Hi all,
I just made a little workflow that uses exiftool for geocoding photos with missing coordinates and sharing here in case it's helpful to anyone. It's about as elegant as a US president but it does the job.
It's useful if you have:
- A linux system
- Some geocoded images at the same/similar location as the photos with missing geodata
- Images organised into rough location subfolders (eg newYork/ london/ madrid/)
For each folder, it will calculate the average coordinates for images with geodata, then write to those without.
- You can run the first script geopica.sh (https://github.com/rylanshearn/geopica/blob/main/geopica.sh) for each folder to find average location for that folder
- If desired, you can use the next script geopic.sh (https://github.com/rylanshearn/geopica/blob/main/geopic.sh) to write those coordinates to images that aren't geocoded
- I kept these separate because some folders may have no images with geocoding, and in this case a configuration file can be set manually in those folders
But if you want to fire everything at once there's a third script that will run the others in for-loops for all folders as long as they're in the same parent directory.
More details and files available at the github repo (https://github.com/rylanshearn/geopica).
Any feedback would be appreciated - I realise a lot of this is probably ignoring the functionality of exiftool and the code could be reduced significantly!
PH Edit: Fixed links to point to scripts on github.
Not trying to dismiss your hard work, but with exiftool, you can create a geotrack out of the images that have coordinates. See Inverse Geotagging (https://exiftool.org/geotag.html#Inverse). While it's more common to see this operation used to extract a track from a video, it can also be used on a set of images.
Then you can use the regular Geotag command with the newly created geotrack.
That's really cool thanks for pointing that out. Exiftool continues to amaze!
I couldn't see how inverse geotagging handles multiple input coordinates in this case. Does it also use a mid-point or average?
I don't know all the details, Phil would have to explain exactly what's happening. But from the top of the Geotagging page
QuoteThe GPS track log file is loaded, and linear interpolation is used to determine the GPS position at the time of the image
The interpolation is done to the time of the image between the GPS fixes with the nearest timestamps on either side of the image time.
- Phil