h1. PhotoPlanet.py README
Jamie Lawrence, 4th August, 2006
*This is a small script to “locate” your photos in “Google Earth”:http://earth.google.com/. It takes a GPS tracklog and a collection of photos, and generated a KML or KMZ file that allows Google Earth to pin thumbnails of your photos at the location where they were taken*
!http://jamie.ideasasylum.com/notebook/images/35.jpg!
h2. Requirements
* Python 2.4 (tested on “ActiveState Python 2.4 for Windows”:http://www.activestate.com/Products/ActivePython/)
* Google Earth (v3 works fine, v4 should also work)
* “EasyGPS”:http://www.topografix.com/ (for generating .gpx files). Free.
* A GPS device (most work with EasyGPS, I used a Garmin 60C)
h2. Installation
Unzip this directory to any location. Done.
h2. Operation
* Make sure that your camera and GPS device are synchronised to exactly the same time
* Make sure that your GPS device is recording a track log whilst you are taking photos
* Load the tracklog into EasyGPS and save it as a GPX file
* From a command prompt, call PhotoPlanet as:
python PhotoPlanet.py -g <.gpx file> -p <photo dir> -o <output file> -z
e.g.
python PhotoPlanet.py -g test2.gpx -p "E:\Documents and Settings\Jamie\Desktop\Test\test2" -o test2.kmz -z
* Omit the -z switch if you just want a KML file (which link to the photos on your hard drive).
* Open the generated KML/KMZ file in Google Earth and your photos will be added
* An example .kmz file is included so you can see what the output is like
h2. Notes
* This script makes use of, and includes, the excellent “EXIF.py”:http://home.cfl.rr.com/genecash/digital_camera/EXIF.py. I didn’t write it.
* The script does NOT write to the photos, so it should be quite safe
* Having said that, I’m not responsible if it doesn’t work or breaks something
h2. Code
The code is reproduced below for information purposes only. You should download “the full archive”:http://jamie.ideasasylum.com/notebook/file_download/7 which includes all the necessary files, a README (mostly this document), and “example .KMZ file”:http://jamie.ideasasylum.com/notebook/file_download/8.
Great!!
You save me lots of work.
I had problems with TimeZone.
I made some small changes to allow enter TZ in cmd.
eg. python PhotoPlanet.py -g -p -o -z -t -3 (GMT-3).
Everything is changed to local time, not GMT.
53a54,55
> parser.add_option(“
t”, “-timezone”, dest=”TZ”,> help=”TimeZone GMT”, metavar=”TZ”)
62a65
> difTZ = int(options.TZ)*60*60
74c77
< time = mktime(strptime(timeString[0:len(timeString)-1], ”%Y-%m-%dT%H:%M:%S”))—-
> time = mktime(strptime(timeString[0:len(timeString)-1], ”%Y-%m-%dT%H:%M:%S”))+difTZ