kml with nodes (one by creation date)

Started by ebardiere, February 01, 2017, 05:52:03 AM

Previous topic - Next topic

ebardiere

Hi,

Thank for Exiftool, it's a unique tool !

I follow the geotag subject and I am able to create a kml.
Actually my script use the following lines (from the forum):
(bash script)
cat kml-start.fmt >$2
exiftool -n -r -q -p kml-placemark.fmt $1>>$2
cat kml-end.fmt>>$2

This script generate a good kml :
...
<Folder>
<name> Waypoints</name>
<open>0</open>
<Placemark>
...
</Placemark>
</Folder>

I have to managed a lot of photos , and if possible I would like to create a kml node for each used date.
And I want to add :
...
<Folder>
<name> Waypoints</name>
<open>0</open>
  <Folder>
  <name> date1 </name>
   <Placemark>
   ...
   </Placemark>
  </Folder>

  <Folder>
  <name> date2 </name>
   <Placemark>
   ...
   </Placemark>
  </Folder>
</Folder>

The main probleme is that if I add a <Folder><name>daten for each photo I have an entry for each photo not for each date.

How can I do this, if any ?

In advance thank you, Emmanuel.(switzerland)

Phil Harvey

First, you can do this all with one file instead of having to cat together various files by using the #[HEAD], #[BODY] and #[TAIL] directives.

And to satisfy your needs, I have added #[SECT] and #[ENDS] directives which allow you to organize the output into sections (based on any criteria you want -- in your case it seems you want to use some date/time tag).  ExifTool 10.41 (just released) contains this new feature.  See the -p option in the exiftool 10.41 application documentation for details.

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

ebardiere

Many thanks,
It progress...
I haven't found how to format fields in fmt file.
This one :
#[SECT] $DateTimeOriginal
$directory/$fileName $gpslatitude" $gpslongitude
#[ENDS]
gives me deg latitude and longitude not numeric version,
if I use $directory/$fileName -n $gpslatitude" $gpslongitude it's not working of course.

How can I do that and same question for $DateTimeOriginal if I want a specific format (only the day for example).

Again thank you for this tool, and Merci !

ebardiere

So sorry, Solution found with command line ...


Phil Harvey

It sounds like you want something like this:

#[SECT] ${DateTimeOriginal;s/ .*//}
$directory/$fileName $gpslatitude $gpslongitude
#[ENDS]


with a command like this:

exiftool -fileorder datetimeoriginal -p my.fmt -n DIR

(assuming the format file is called "my.fmt")

Here the -n option returns the numerical values for all tags, so GPSLatitude and GPSLongitude are formatted as decimal degrees.

And the advanced formatting expression for DateTimeOriginal removes the time, leaving only the date.

I have also added the -fileorder option to make sure files are sorted by DateTimeOriginal.

- Phil

P.S. I will move this thread to the ExifTool application board because this is the application, not the API.
...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 ($).