I would like to parse a KML document in order to put the information (names of placemarks, coordinates) into a python array for further processing. This is what I have so far:
from fastkml import kml with open('evalPoints.kml') as myfile: doc=myfile.read() k = kml.KML() k.from_string(doc) outerFeature = list(k.features()) innerFeature = list(outerFeature.features()) placemarks = list(innerFeature.features()) for p in placemarks: coords = p.coordinates #this does not work
Unfortunately, parsing the coordinates does not work, while parsing the name of the placemarks works like a charm with
p.name. What am I doing wrong?