Reverse Geocoding (feature request)

Started by Happy Hobo, September 15, 2021, 07:40:52 PM

Previous topic - Next topic

Happy Hobo

It would be convenient if exiftool could access a geocoding API or database with GPSCoord and output Location as if it were an actual tag.

Compare https://stackoverflow.com/questions/32875276/reverse-geocoding-in-bash-using-gps-position-from-exiftool

I have thousand of photos organized by date/time and location.  Unfortunately, the sorting was done by Apple's Photo.app, which seems to get either the date/time or the location wrong sometimes.  A feature like this would help me find the ones Apple put in the wrong place and put them back where they belong.

As the link shows, there are other ways to do it, but having it built-in would be amazing.

Alan Clifford

That does seem to be city based.  What happens if you are in the middle of a field in the middle of nowhere or 5 k of the coast in the sea?

Happy Hobo

#2
Some geocode databases will always tell you a city.  Some appear to be more general. 

In 2013, we passed a large cemetery on a highway between cities at 45°15'50.40"N 08°45'37.80"E.  I don't re3call the service I used but it converted those coordinates into "Strada Statale 494,27036 Mortara,Province of Pavia,Italy"

For most purposes, some reliability would be wanted.  For my limited purpose, if it says anywhere in Spain, I'll know the date wasn't when I was in Turkey or Taiwan.

Happy Hobo

#3
Currently, I use exiftool to create a CSV with filename, lat, long, date/time and feed that to https://www.geoapify.com/tools/reverse-geocoding-online

Then I edit the result into a script I can use to update filenames or sort by location or add comment or whatever.

I could write code or script to automate my "edit the result" but I do a lot less of that sort of thing since I retired.

This process is good enough for me.  Even with the manual steps, it only takes a couple of days to straighten out the mess Apple caused on nearly three thousand images and videos.

www.geoapify.com offers an API that could be used instead of the only service.  No charge for less than three thousand queries per day.

Phil Harvey

I don't want to add anything to ExifTool that relies on an external service.

StarGeek actually wrote a config file for ExifTool to do what you want via the Google Maps service, but then Google started charging for the service which made it so that StarGeek's code wasn't useful to the general public.

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

dwest4277

Quote from: Happy Hobo on September 14, 2022, 05:46:06 PMCurrently, I use exiftool to create a CSV with filename, lat, long, date/time and feed that to https://www.geoapify.com/tools/reverse-geocoding-online


Hi
Would you be willing to post a line of one of your CSV files that shows how to format the data that is sent to Geoapify?

I have prob 60,000 pics to reverse geocode over the next day/month/year/decade :o  :o  and your methodology seems very doable given a "bit" of time. One I get the data formats, then I get to figuring out the ExifTool commands
Thx
Dean

GoodKarma

I use Lightroom (just for cataloging so it's free) and Jeffreys Lightroom plugin (which is donationware) from there you can use either openstreet Map or google API (you'll need API key for Google. or both. The plugin will also let you fill in things like what3words location and create map urls. I have found it indispensable

Happy Hobo

Quote from: dwest4277 on January 23, 2023, 07:54:01 PMWould you be willing to post a line of one of your CSV files that shows how to format the data that is sent to Geoapify?
Here are the first two lines of one of my CSV files:
SourceFile,GPSLatitude,GPSLongitude,CreateDate,GPSDateTime,DateTimeOriginal,FileModifyDate
20170607_094630.JPG,53.485067,-2.254850,2017:06:07 09:46:30,2017:06:07 08:46:29.95Z,2017:06:07 09:46:30,2023:09:04 08:30:48-07:00
And here is the command that creates the file:
  # make an index of selected metadata
  exiftool -csv                  \
           -c   "%+.6f"          \
           -api filter="s/^\+//" \
           -GPSLatitude          \
           -GPSLongitude         \
           -CreateDate           \
           -GPSDateTime          \
           -DateTimeOriginal     \
           -CreationDate         \
           -FileModifyDate         *     >  /tmp/$2.csv
But for 60,000 pics, you're better off finding and using an API.  The geoapify website only takes 500 lines at a time.

FrankB

Maybe you're not using Windows, so it's of no use to you, but I have added an issue in GitHub to investigate the options to do this in ExifToolGui.

https://github.com/FrankBijnen/ExifToolGui/issues/126

I will look at the api from: https://geocode.maps.co/