#!/usr/bin/awk -f # # exif2kml -- make KML file from GPS data in EXIF # # usage: ls *.jpg | exif2kml > my.kml # (see below for more examples) # # http://www.heikopurnhagen.net/software/exif2kml # # This program is available under the terms of the GNU General Public # License (GPL). All usual disclaimers apply! # # requires exiftool # http://www.sno.phy.queensu.ca/~phil/exiftool/ # # Heiko Purnhagen (mail@heikopurnhagen.net) # HP 20090530 BEGIN { if (ARGC==1) { print "usage: \\ls *.jpg | exif2kml > my.kml" > "/dev/stderr"; print "" > "/dev/stderr"; } title = "exif2kml"; } { if (NR==1) { print "\n\ \n\ \n\ Paths\n\ \n\ " title "\n\ \n\ 1\n\ "; } img = $1; getlla = "exiftool -S -GPSPosition -c '%f' -GPSAltitude " img; getlla | getline strlatlon; getlla | getline stralt; close(getlla); # print "getlla >" strlatlon "<"; # print "getlla >" stralt "<"; split(strlatlon,latlon); split(stralt,alt); if (latlon[1]=="GPSPosition:") { if (latlon[5]=="W") { printf "-"; } printf "%s,",latlon[4]; if (latlon[3]=="S") { printf "-"; } printf "%s",latlon[2]; if (alt[1]=="GPSAltitude:") { printf ",%s",alt[2]; } printf "\n"; } } END { print " \n\ \n\ \n\ \n\ "; } #--