ExifTool Forum

ExifTool => Developers => Topic started by: servanges on February 01, 2019, 12:19:06 PM

Title: Geotagging with perl library
Post by: servanges on February 01, 2019, 12:19:06 PM
Hello,

I'm using the Exif Perl Library which is very useful.
I also want to use it for geotagging my pictures from GPX files.
I can't see how to do it in documentation ....

Can you help me? or may I use a GPX library and integrate the position by myself...

Thank you

Title: Re: Geotagging with perl library
Post by: StarGeek on February 01, 2019, 12:32:03 PM
Take a look a the Geotagging with ExifTool (https://exiftool.org/geotag.html) for some of the basics for the command line.

Translating that to using Perl might take a response from Phil (the author) who is currently on vacation.
Title: Re: Geotagging with perl library
Post by: servanges on February 01, 2019, 12:51:34 PM
Thank you for your answer  :)

Yes I know the command line, but I don't know how to "translate" in into Perl

Title: Re: Geotagging with perl library
Post by: Hayo Baan on February 03, 2019, 07:24:30 AM
Have you already read the documentation (https://www.exiftool.org/ExifTool.html)? From that and knowing what the command line would look like it should be pretty straightforward. If not, can you share the command-line you want to run as Perl code?
Title: Re: Geotagging with perl library
Post by: servanges on February 04, 2019, 03:08:53 PM
Thank you for your answer

I don't find information about geotagging in the Exiflib documentation

The command line will look like this one
exiftool -geotag=track.log /Users/Phil/Pictures

cf the geotagging page https://exiftool.org/geotag.html (https://exiftool.org/geotag.html)

And I don't know how view in the Exiftool library how the command line is interpreted
Title: Re: Geotagging with perl library
Post by: Hayo Baan on February 05, 2019, 01:36:32 AM
Ah, I see. You want to use the Perl API to match the gps track, not write individual tags. This is something that isn't possible. I see three alternatives:

The first alternative is the simplest, of course.
Title: Re: Geotagging with perl library
Post by: servanges on February 06, 2019, 02:14:46 AM
I can't use the command line, because in my directory, I can have hundreds of pictures already geotagged or that can't be geotagged.

So if I can't do it directly with Phil's help, I'll use the GPX library to putthe positionin each photos.

Do you know if Phil is oftenly looking to this forum ?

Title: Re: Geotagging with perl library
Post by: Hayo Baan on February 06, 2019, 06:40:14 AM
Quote from: servanges on February 06, 2019, 02:14:46 AM
So if I can't do it directly with Phil's help, I'll use the GPX library to putthe positionin each photos.

Do you know if Phil is oftenly looking to this forum ?

Phil is currently on vacation, but when he's back he'll get back to you (he reads the forums multiple times a day)
Title: Re: Geotagging with perl library
Post by: StarGeek on February 06, 2019, 12:38:19 PM
Quote from: servanges on February 06, 2019, 02:14:46 AM
I can't use the command line, because in my directory, I can have hundreds of pictures already geotagged or that can't be geotagged.

I'm not sure I understand why you can't use the command line.  Files that are already geotagged can be skipped with -if "not defined $GPSLatitude".  Why can't the others be geotagged?  If they don't have the timestamp or are not in the geotrack, they'll be skipped.  If they're not a supported filetype, they'll be skipped.
Title: Re: Geotagging with perl library
Post by: Phil Harvey on February 08, 2019, 01:10:58 PM
All you need to do is use SetNewValue() to set the value of the GeoTag tag (to the name of the GPS file), and use SetNewValuesFromFile() to set GeoTime to DateTimeOriginal (or whatever tag you want), then call WriteImage() to do the geotagging.  See the "Programmers" notes on this page (https://exiftool.org/geotag.html).

- Phil
Title: Re: Geotagging with perl library
Post by: servanges on February 10, 2019, 03:00:30 PM
Hi,

Thank you very much for your help, and all the work you do

It's very simple to use, very good architecture though to help. (Sorry, I've missed the programmer lines)

I'll try very soon.

Claude
Title: Re: Geotagging with perl library
Post by: Hayo Baan on February 10, 2019, 04:31:05 PM
Nice! I had no idea that it would be possible to set the tag this way. I missed this part of the docs too  ::)
Title: Re: Geotagging with perl library
Post by: Phil Harvey on February 10, 2019, 08:43:30 PM
Those Extra Tags (https://exiftool.org/TagNames/Extra.html) are a treasure trove.

- Phil