I am trying to parse a kml file using django. I am using pyKML Parser Module. I have completed the following steps.
root = parser.fromstring(open('myfile.kml').read())
The content of the file is:
<document>
<Placemark>
<name>t1</name>
<Point><coordinates>v1</coordinates>
</Point>
</Placemark>
<Placemark>
<name>t2</name>
<Polygon>
<outerBoundaryIs>
<LinearRing><coordinates>v2</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polgon>
</Placemark>
</document>
I am able to retrieve the names using the following:
name = []
for ele in root.Document.Placemark:
name.append(ele.name)
But i dont know how the retrieve the coordinates values from different Placemark. Please help me here.