summaryrefslogtreecommitdiff
path: root/fmt_files/kml.fmt
blob: cbff7515465200ee02673a525bbe8726e8a38c63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#------------------------------------------------------------------------------
# File:         kml.fmt
#
# Description:  Example ExifTool print format file for generating a
#               Google Earth KML file from a collection of geotagged images
#
# Usage:        exiftool -p kml.fmt -r DIR [...] > out.kml
#
# Requires:     ExifTool version 10.41 or later
#
# Revisions:    2010/02/05 - P. Harvey created
#               2013/02/05 - PH Fixed camera icon to work with new Google Earth
#               2017/02/02 - PH Organize into folders based on file directory
#               2018/01/04 - PH Added IF to be sure position exists
#               2020/01/11 - F. Kotov Limited image preview size to 500px
#
# Notes:     1) Input files must contain GPSLatitude and GPSLongitude.
#            2) Add the -ee3 option to extract the full track from video files.
#            3) For Google Earth to be able to find the images, the input
#               images must be specified using relative paths, and "out.kml"
#               must stay in the same directory as where the command was run.
#            4) Google Earth is picky about the case of the image file extension,
#               and may not be able to display the image if an upper-case
#               extension is used.
#            5) The -fileOrder option may be used to control the order of the
#               generated placemarks when processing multiple files.
#            6) The "0" in the coordinates line may be changed to "$gpsaltitude#"
#               and the altitudeMode may be changed to "absolute" to store
#               altitude information if it exists in the track log.
#------------------------------------------------------------------------------
#[HEAD]<?xml version="1.0" encoding="UTF-8"?>
#[HEAD]<kml xmlns="http://earth.google.com/kml/2.0">
#[HEAD]  <Document>
#[HEAD]    <name>My Photos</name>
#[HEAD]    <open>1</open>
#[HEAD]    <Style id="Photo">
#[HEAD]      <IconStyle>
#[HEAD]        <Icon>
#[HEAD]          <href>http://maps.google.com/mapfiles/kml/pal4/icon38.png</href>
#[HEAD]          <scale>1.0</scale>
#[HEAD]        </Icon>
#[HEAD]      </IconStyle>
#[HEAD]    </Style>
#[SECT]    <Folder>
#[SECT]      <name>$main:directory</name>
#[SECT]      <open>0</open>
#[IF]  $gpslatitude $gpslongitude
#[BODY]      <Placemark>
#[BODY]        <description><![CDATA[<img src='$main:directory/$main:filename'
#[BODY]          style='max-width:500px;max-height:500px;'> ]]>
#[BODY]        </description>
#[BODY]        <Snippet/>
#[BODY]        <name>$filename</name>
#[BODY]        <styleUrl>#Photo</styleUrl>
#[BODY]        <Point>
#[BODY]          <altitudeMode>clampedToGround</altitudeMode>
#[BODY]          <coordinates>$gpslongitude#,$gpslatitude#,0</coordinates>
#[BODY]        </Point>
#[BODY]      </Placemark>
#[ENDS]    </Folder>
#[TAIL]  </Document>
#[TAIL]</kml>