ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dwlott on May 26, 2024, 05:48:48 PM

Title: Getting started with geolocation
Post by: dwlott on May 26, 2024, 05:48:48 PM
Please help me get geolocation working. I'm using geolocation.html for documentation.
My test file has good GPSLatitude and GPSLongitude. I want to test the first example illustrated in geolocation.html.

Trying an args file:
#args file
-api
geolocation
"-geolocation*"
E:\test.jpg

Exiftool replies with all the tags in the test file, but not the Geolocation City, Region etc as shown in the example.

Strait from the command line.
exiftool -api geolocation "-geolocation*" test.jpg
No reply from exiftool using the this command.
Title: Re: Getting started with geolocation
Post by: StarGeek on May 26, 2024, 06:44:13 PM
FAQ #29, "My options don't work in a -@ ARGFILE" (https://exiftool.org/faq.html#Q29)
QuoteAlso, arguments should not be quoted
Title: Re: Getting started with geolocation
Post by: dwlott on May 26, 2024, 07:35:07 PM
Thank you Stargeek for the faq referance.  I adjusted the args file code, but see no output from exiftool when using this args file.

#
 MetaToolExcel command
-api
geolocation
-geolocation*
E:\exiftool\test.jpg
Title: Re: Getting started with geolocation
Post by: StarGeek on May 26, 2024, 07:54:20 PM
Are you using an up to date exiftool?  Also, don't separate the hashtag from the comment text.

C:\>exiftool -ver
12.85

C:\>type temp.txt
# args file
-api
geolocation
-geolocation*
y:\!temp\Test4.jpg

C:\>exiftool -G1 -a -s -@ temp.txt
[ExifTool]      GeolocationCity                 : Financial District
[ExifTool]      GeolocationRegion               : New York
[ExifTool]      GeolocationSubregion            : New York County
[ExifTool]      GeolocationCountryCode          : US
[ExifTool]      GeolocationCountry              : United States
[ExifTool]      GeolocationTimeZone             : America/New_York
[ExifTool]      GeolocationFeatureCode          : PPLX
[ExifTool]      GeolocationFeatureType          : Section Of Populated Place
[ExifTool]      GeolocationPopulation           : 61000
[ExifTool]      GeolocationPosition             : 40.7080, -74.0087
[ExifTool]      GeolocationDistance             : 3.66 km
[ExifTool]      GeolocationBearing              : 62
Title: Re: Getting started with geolocation
Post by: dwlott on May 26, 2024, 10:02:38 PM
Quote from: StarGeek on May 26, 2024, 07:54:20 PMAre you using an up to date exiftool?
The update helped and now I see the expected output.

I'm wondering if there is a command to have exiftool go ahead and write the output to the appropriate location tags.  Using the files GPS info to lookup and write the location tags would save much work.


Title: Re: Getting started with geolocation
Post by: StarGeek on May 26, 2024, 11:06:28 PM
Writing Geolocation Tags while Geotagging (https://exiftool.org/geotag.html#Geolocation)
QuoteGeolocation city, state/province and country tags may be written automatically based on the geotagged GPS position by setting the Geolocate tag to "geotag".
Title: Re: Getting started with geolocation
Post by: Phil Harvey on May 27, 2024, 01:14:31 PM
The -geolocate=geotag feature is used if you are geotagging from a GPS track log.  If the file already contains GPS, probably you should use "-geolocate<gpsposition"

- Phil

Edit: Fixed incorrect tag name
Title: Re: Getting started with geolocation
Post by: StarGeek on May 27, 2024, 01:31:43 PM
Quote from: Phil Harvey on May 27, 2024, 01:14:31 PMThe -geolocation=geotag feature is used if you are geotagging from a GPS track log.  If the file already contains GPS, probably you should use "-geolocation<gpsposition"

Ah, good to know **takes notes**
Title: Re: Getting started with geolocation
Post by: Phil Harvey on May 27, 2024, 01:40:25 PM
Oops.  Typo at my end.  The tag is called Geolocate.  "Geolocation" is the API option.  I've made that mistake a few times.  I'll fix my previous post.

- Phil
Title: Re: Getting started with geolocation
Post by: dwlott on May 27, 2024, 06:45:10 PM
Quote from: Phil Harvey on May 27, 2024, 01:14:31 PM"-geolocate<gpsposition"
The -geolocate feature is a dream come true for auto generation of location content.
Thank you Phil.
Title: Re: Getting started with geolocation
Post by: dwlott on June 07, 2024, 10:26:07 AM
Please help with writing to specific groups with Geolocate.
I am referencing this example in the Geolocate html document:
exiftool -xmp:iptc:geolocate="paris,fr" test.jpg
This args file writes the location tags with no errors:
-IPTC:geolocate<gpsposition
E:\mySourceFolder\gps clean\IMG_20161228_120612.jpg
-o
e:\myTargetFolder\%f.%e

Using this command, ExifTool returns the error
Quote" Warning: Sorry, xmp:ipctext:Geolocate doesn't exist or isn't writable".

-XMP:ipctExt:geolocate<gpsposition
E:\mySourceFolder\gps clean\IMG_20161228_120612.jpg
-o
e:\myTargetFolder\%f.%e
Title: Re: Getting started with geolocation
Post by: StarGeek on June 07, 2024, 11:38:01 AM
I think what you want is
-XMP-iptcExt:geolocate<GPSPosition
Title: Re: Getting started with geolocation
Post by: dwlott on June 07, 2024, 11:44:05 AM
Quote from: StarGeek on June 07, 2024, 11:38:01 AMI think what you want is
-XMP-iptcExt:geolocate<GPSPosition

I tried:
-XMP-ipctExt:geolocate<gpsposition
E:\mySourceFolder\gps clean\20230915_191829.jpg
-o
e:\myTargetFolder\%f.%e
QuoteExiftool: Warning: Sorry, xmp-ipctext:Geolocate doesn't exist or isn't writable
Title: Re: Getting started with geolocation
Post by: dwlott on June 07, 2024, 11:53:55 AM
Please help also with using a config file to access the larger Geolocate database.
I want to use a variable in place of the path to ExifTool.
I am using this config file line in the html documentation for reference:
$Image::ExifTool::Geolocation::geoDir = '/PATH/TO/Geolocation500';
I am hoping to replace '/PATH/TO/ with a variable name.  I'm also unsure of the slash \/ to use for windows. 

The Windows 10 path will be the exiftool_files path created by the Betz install:
QuoteE:\exiftool\exiftool_files\Geolocation500

To illustrate, here is an incorrect config file line. 
$Image::ExifTool::Geolocation::geoDir = @PathToExifTool & '\exiftool_files\Geolocation500';


Title: Re: Getting started with geolocation
Post by: StarGeek on June 07, 2024, 01:39:54 PM
Quote from: dwlott on June 07, 2024, 11:44:05 AM
Quote from: StarGeek on June 07, 2024, 11:38:01 AMI think what you want is
-XMP-iptcExt:geolocate<GPSPosition

I tried:
-XMP-ipctExt:geolocate<gpsposition

It's -XMP-iptcExt, not -XMP-ipctExt
Title: Re: Getting started with geolocation
Post by: Phil Harvey on June 07, 2024, 01:57:17 PM
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
Title: Re: Getting started with geolocation
Post by: dwlott on June 08, 2024, 04:50:25 PM
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

Title: Re: Getting started with geolocation
Post by: dwlott on June 08, 2024, 06:22:48 PM
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?

Title: Re: Getting started with geolocation
Post by: Phil Harvey on June 08, 2024, 08:33:47 PM
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
Title: Re: Getting started with geolocation
Post by: Wilfred C on March 30, 2025, 06:49:31 AM
hi, I've tried "exiftool Folder -geolocate<GPSposition" but I'm getting this response: "The system cannot find the file specified". What am I doing wrong please?
Title: Re: Getting started with geolocation
Post by: Phil Harvey on March 30, 2025, 11:22:10 AM
You need quotes around "-geolocate<gpsposition" or your shell will interpret the less-than symbol as redirection from a file named "GPSPosition".

- Phil
Title: Re: Getting started with geolocation
Post by: Wilfred C on March 30, 2025, 03:17:55 PM
Thank you so much, that worked!