In pykml, I can read the first placemark in a file using the following code:
with open(filename) as f:
pm = parser.parse(f).getroot().Document.Folder
print "got :"
print pm.Placemark.LineString.coordinates
How can I read multiple placemarks in the same file into python?
This works:
with open(filename) as f:
doc = parser.parse(f).getroot().Document.Folder
for pm in doc.iterchildren():
if hasattr(pm, 'LineString'):
print pm.LineString.coordinates