Example - getting all GroundOverlays

33 views
Skip to first unread message

Graeme Merrall

unread,
Aug 26, 2012, 3:30:28 AM8/26/12
to pykml-...@googlegroups.com
Not a very active group but pyKML I have to say is jolly useful.  Website says you'd like examples of KML use. Here's one to pull out all GroundOverlay tag. Will work for most things.  Idea of the greater script is to use gdal to georeference images for "proper" GIS apps instead of relying on overlays. 

root = parser.fromstring(kml_str)
  for x in root.findall(".//{http://www.opengis.net/kml/2.2}GroundOverlay"):
    overlay = {}
    overlay['href'] = x.Icon.href
    overlay['north'] = x.LatLonBox.north
    overlay['south'] = x.LatLonBox.south
    overlay['east'] = x.LatLonBox.east
    overlay['west'] = x.LatLonBox.west
    GeorefImage(overlay)


Cheers,
 Graeme

Tyler Erickson

unread,
Aug 27, 2012, 12:46:47 PM8/27/12
to pykml-...@googlegroups.com
I'm glad that you have found it useful.  Having examples that show how to integrate with GDAL or other Python geospatial libraries are indeed welcome, if you can share them.
Reply all
Reply to author
Forward
0 new messages