Composite tag to geocode lat and lon to city, state, country (config file)

Started by CWCorrea, March 02, 2024, 10:04:37 PM

Previous topic - Next topic

wywh


FrankB

Quote from: Phil Harvey on March 05, 2024, 03:31:45 PMI've just released version 12.78 with the new Geolocation feature.  Have fun with it! :)

- Phil

I'm playing and having fun. Thanks.
I do have some questions, but since they're more ExifToolGui I will post it there.

Phil Harvey

Hi Matti,

Quote from: wywh on March 06, 2024, 05:20:02 AMGreat! Which database does it use?

The >1000-population city database from geonames.org that FrankB mentioned, but I have reformatted the database to reduce the file size.

I've already added another feature to allow user-defined cities to be added, and am using that myself to geolocate pictures from my last trip because we stayed in some very small towns that aren't in the database.  The user-defined city feature will appear in 12.79.  I may also provide the geonames.org >500-population database as an optional download.

- Phil

Edit: I've uploaded the  >500-population database in case someone wants to use it.  Just unzip it and either replace lib/Image/ExifTool/Geolocation.dat with this new file, or set $Image::ExifTool::Geolocation::databaseFile in your ExifTool config file to the path name of the database file.
...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 ($).

FrankB


wywh

Quote from: Phil Harvey on March 06, 2024, 09:49:48 AMThe >1000-population city database from geonames.org that FrankB mentioned, but I have reformatted the database to reduce the file size.

Thanks for the info. I compared city center GPS coordinates that 'exiftool -api geolocation=44.03411,-72.06292' gives (44.033,-72.065) and what the cities1000.txt gives (44.03451,-72.06398) and wondered if some another database was used because they are slightly different.

I wonder who has determined all those city centers because many seem to be just casually thrown there  ???

- Matti

Phil Harvey

Hi Matti,

Yes, I packed the coordinates into 2-byte integers, so there was some rounding.

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

StarGeek

Is there a definition to the Geolocation.dat format so that it could be possible to make our own from some other database?

Also, for the Windows executable, maybe check the executable's directory for a replacement Geolocation.dat?
"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

Phil Harvey

The format specification is in the comments of Geolocation.pm, and I describe how to use an alternate database at the bottom of the Geolocation instructions here.  However the next release will allow user-defined cities and give an example of how to import a CSV-format database.

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

Phil Harvey

It would have been cool if I could use this feature to automatically set the default time zone when geotagging from a GPX file, but unfortunately it is a chicken-and-egg problem because the location needs to be known to determine the time zone, and the time zone needs to be known to look up the location in the GPX track.  :(  Darn.

However, I will enhance the -geotag feature in ExifTool 12.79 to allow the Geolocation tags to be set at the same time as the GPS tags.

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