Getting started with geolocation

Started by dwlott, May 26, 2024, 05:48:48 PM

Previous topic - Next topic

Phil Harvey

You should use forward slashes in the path name.  I don't know what you are doing with @PathToExifTool in the config file because the config file is Perl so a scalar variable name would start with "$", not "@", and the "." operator is for string concatenation, not "&".

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

dwlott

Quote from: StarGeek on June 07, 2024, 11:38:01 AMIt's -XMP-iptcExt, not -XMP-ipctExt

Thank you Stargeek. With that correction, this command works great for writing the location tags to the specified group.
-XMP-iptcExt:geolocate<gpsposition
E:\mySourceFolder\gps clean\20230915_191829.jpg
-o
e:\myTargetFolder\%f.%e


dwlott

I've no experience in Perl, but I'm ready to learn!

#------------------------------------------------------------------------------
# File:        Geolocate.config
# Description:  Enables use of the Geolocation500 Database.
# Notes:        None
# Revisions:    2024/06/10 - Dave Lott Created
#------------------------------------------------------------------------------
$Image::ExifTool::Geolocation::geoDir = 'E:\ExifTool\exiftool_files\Geolocation500';
#end

This config file enables the 500 database.
In this config file, I would like to replace "e:\exiftool" with a variable that would return the path to exiftool, so that the config file would be able to find path to the 500 database relative to the exiftool path.
From what Phil wrote earlier, I'm guessing the variable would begin with $ and the string would join with a .

So, something like:

$Image::ExifTool::Geolocation::geoDir = $PathToExiftool . '\exiftool_files\Geolocation500';

$PathToExiftool is my wild guess, as is the whole line.  Can a config file variable return the path to exiftool?


Phil Harvey

Getting the path to exiftool isn't as simple as you may think.  It depends on which version of ExifTool you are running and which "exiftool" you are talking about.  Either the Perl $^X or $0 should contain the path you need, but you will have to remove everything after the last "/".  See the code in the BEGIN block at the top of the exiftool source code to see how exiftool does it.

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