Getting started with geolocation

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

Previous topic - Next topic

dwlott

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.

StarGeek

"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

dwlott

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

StarGeek

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
"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

dwlott

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.



StarGeek

Writing Geolocation Tags while Geotagging
QuoteGeolocation city, state/province and country tags may be written automatically based on the geotagged GPS position by setting the Geolocate tag to "geotag".
"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

#6
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
...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

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**
"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

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
...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: 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.

dwlott

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

StarGeek

I think what you want is
-XMP-iptcExt:geolocate<GPSPosition
"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

dwlott

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

dwlott

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';



StarGeek

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
"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

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