Few days ago Google release an open source library targeted at KML files: libkml. There is also bindings for python available.
A good opportunity to try it out was to simplify my previous python tagging script.
Using the lib is easy from the examples on Google’s website:
coordinates = factory.CreateCoordinates() coordinates.add_point3(lon,lat,alt)
to create coordinates for examples. All elements are created and combined together in a kmldom::Document
which is passed to a kmldom::Kml
then written to a file.
Here is the full script:
jpegtokml.py.
Just run as python jpegtokml.py
Enjoy !
NB: You’ll need to get the libkml cvs version >= r33 at least for this to work
EDIT 2009-08-30: after few updates due to my trip in South Africa (south hemisphere), i’ve updated the script and find more convenient to put it on http://code.google.com/p/jpegtokml/.