Main Menu

GPX error

Started by neil40, February 02, 2017, 12:39:30 PM

Previous topic - Next topic

Phil Harvey

BTW, I have updated the kml.fmt that will ship with the next ExifTool release to group the files by directory.  Attached is the new version in case you are interested in using this feature.

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

neil40

Quote from: Phil Harvey on February 03, 2017, 09:10:44 AM
BTW, I have updated the kml.fmt that will ship with the next ExifTool release to group the files by directory.  Attached is the new version in case you are interested in using this feature.

- Phil
Thanks for the updated file Phil

Is there a definitive list of variables that exiftool can use with KML?

Phil Harvey

Sure.  The list is here.  You may use any of the 20,000+ tags that ExifTool extracts.

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

neil40

Quote from: Phil Harvey on February 04, 2017, 09:25:26 PM
Sure.  The list is here.  You may use any of the 20,000+ tags that ExifTool extracts.

- Phil
Wow! Well I thought that was a bit daunting, but looking at the data stored in the JPG's I want to be able to write
XMP-iptcCore:Location
XMP-photoshop:City
XMP-photoshop:State
XMP-photoshop:Country

So I presume these are $location, $city, $state and $country

My problem is I don't know how to write them into the KML file.
I presume they need to go into the <Snippet/> structure.

I tried
#[BODY]  <name>$filename</name>
#[BODY]  <name>$location</name>

but while this does extract both to the KML file, when opened in Google Earth, the second line overwrites the first.

I then tried
#[BODY]  <name>$filename</name>
#[BODY]  <location>$location</location>

but the latter tag is ignored in GE.

Any ideas how I achieve that so I can have
<filename>
<location>
<city>
<state>
<country>

showing with the picture?

Phil Harvey

Quote from: neil40 on February 06, 2017, 04:05:59 PM
XMP-iptcCore:Location
XMP-photoshop:City
XMP-photoshop:State
XMP-photoshop:Country

So I presume these are $location, $city, $state and $country

That will do, but may also pick up other tags with the same name.  If you want to specify them more precisely, use $XMP-iptcCore:Location, $XMP-photoshop:City, $XMP-photoshop:State and $XMP-photoshop:Country.

QuoteAny ideas how I achieve that so I can have
<filename>
<location>
<city>
<state>
<country>

showing with the picture?

That's a KML question.  I'm not a KML expert, but I think that the "Using the CDATA Element" section from the reference I found may show a way to do this.

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

neil40

Quote from: Phil Harvey on February 07, 2017, 07:21:20 AM
QuoteAny ideas how I achieve that so I can have
<filename>
<location>
<city>
<state>
<country>

showing with the picture?

That's a KML question.  I'm not a KML expert, but I think that the "Using the CDATA Element" section from the reference I found may show a way to do this.

- Phil
Phil,

Thanks for the tips on the specific variables.
Looking at the CDATA element closer, I have modified my KML.fmt file as follows, and this works well
#[BODY]        <description><![CDATA[<br/><table><tr><td>
#[BODY]        <img src='$directory/$filename'
#[BODY]          width='${imagewidth;$_/=5}' height='${imageheight;$_/=5}'>
#[BODY]          <hr><b>Coordinates:</b>&nbsp;$gpsposition
#[BODY]          <br><b>Location:</b>&nbsp;$XMP-iptcCore:Location
#[BODY]          <br><b>City:</b>&nbsp;$XMP-photoshop:City
#[BODY]          <br><b>State:</b>&nbsp;$XMP-photoshop:State
#[BODY]          <br><b>Country:</b>&nbsp;$XMP-photoshop:Country
#[BODY]          <br><b>Date taken:</b>&nbsp;$datetimecreated
#[BODY]        </td></tr></table>]]></description>


Is there a way to adapt the $datetimecreated variable so that I can display the date and time in a more standard (UK) fashion such as 07-02-2017 10:43:01 (or even 7th February 2017 10:43:01)?

Phil Harvey

The -d option formats date/time values.  See the examples on this page (although these examples show how to format date/time values for file names, the same applies for your purpose).  And here is a list of common date format codes.

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

neil40

#22
Quote from: Phil Harvey on February 07, 2017, 09:54:59 PM
The -d option formats date/time values.  See the examples on this page (although these examples show how to format date/time values for file names, the same applies for your purpose).  And here is a list of common date format codes.

- Phil
Phil, are you implying that I need to write these values to the files beforehand? [Edit] - hmm, don't think you are!

I had noticed you had suggested the modification to the imageheight and imagewidth variables like so ${imagewidth;$_/=5} to reduce the size of image output, so I'd wondered if it was possible to do the same to the datetimecreated variable, to display it differently?
I'm happy looking at the page you directed me to on what I want, it was just a case of how to modify the variable (if I can)
All the examples given are for renaming or moving files.

[Edit] - been trying a few things in the fmt file, but can't figure out how to apply a -d to $datetimecreated !! Just get errors (mostly syntax)  :-\

Phil Harvey

Quote from: neil40 on February 08, 2017, 05:38:34 AM
Phil, are you implying that I need to write these values to the files beforehand?

The -d option just formats the values of the date/time tags already in the file.

QuoteI had noticed you had suggested the modification to the imageheight and imagewidth variables like so ${imagewidth;$_/=5} to reduce the size of image output, so I'd wondered if it was possible to do the same to the datetimecreated variable, to display it differently?

This is certainly possible, but much more difficult.  The -d is much simpler.  Just add the -d option to your existing command to see what I mean.

QuoteAll the examples given are for renaming or moving files.

Yes.  I mentioned this.  I gave that reference just so you could see some examples of ways to format date/time tags.

Quote[Edit] - been trying a few things in the fmt file, but can't figure out how to apply a -d to $datetimecreated !! Just get errors (mostly syntax)  :-\

I thought it would be simple.  Just add something like this to the command you are using to create the KML file:

    -d "%Y-%m-%d %H:%M:%S"

But you will want to change the formatting codes to give the format you want, and the page I referenced should help with this.

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

neil40

Aha, I was overthinking it!
Works perfectly.

Further to your help yesterday suggesting I look at CDATA, I noticed that Geosetter had a GE export tool, which allows custom output of various exif data.

So I created a KMZ file then exported to KML in GE, so I could see the format of the CDATA section which gave me the final clues I need to modify my .fmt file.

Geosetter also allows you to create an icon of the picture you are exporting to GE - is that a feature of exiftool or is it Geosetter? (as Geosetter is using exiftool under the hood)

Phil Harvey

Hi Neil,

ExifTool doesn't do image manipulation.  It may be used to extract an existing thumbnail or preview image, but that's it.  I don't know how the icon you mention is generated.

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

neil40

Quote from: Phil Harvey on February 08, 2017, 07:29:20 AM
ExifTool doesn't do image manipulation.  It may be used to extract an existing thumbnail or preview image, but that's it.  I don't know how the icon you mention is generated.

- Phil
I suspected as much, but wanted to check.