Geotagging with perl library

Started by servanges, February 01, 2019, 12:19:06 PM

Previous topic - Next topic

servanges

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


StarGeek

Take a look a the Geotagging with ExifTool 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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

servanges

Thank you for your answer  :)

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


Hayo Baan

Have you already read the documentation? 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?
Hayo Baan – Photography
Web: www.hayobaan.nl

servanges

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

And I don't know how view in the Exiftool library how the command line is interpreted

Hayo Baan

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:

  • Call that exiftool command from within exiftool using e.g. the system command or backtick operator.
  • Write your own matching code and use the API functions to write the metadata to the file(s).
  • Ask Phil if there is an internal function that accomplishes this and then make use of that function.

The first alternative is the simplest, of course.
Hayo Baan – Photography
Web: www.hayobaan.nl

servanges

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 ?


Hayo Baan

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)
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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.

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

servanges

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

Hayo Baan

Nice! I had no idea that it would be possible to set the tag this way. I missed this part of the docs too  ::)
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

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