Commit 224b4af3 authored by Christian Ledermann's avatar Christian Ledermann

Merge pull request #40 from heltonbiker/master

Adding examples folder
parents 76e3d27a 6785bf28
This diff is collapsed.
Simply run `UsageExamples.py` to see some ways to use `fastkml` library (which should already be [installed](https://github.com/heltonbiker/fastkml#install)).
File `KML_Samples.kml` was found in [Google Developers](https://developers.google.com/kml/documentation/KML_Samples.kml) site.
#!/usr/bin/env python
# coding: utf-8
from fastkml import kml
def print_child_features(element):
""" Prints the name of every child node of the given element, recursively """
if not getattr(element, 'features', None):
return
for feature in element.features():
print feature.name
print_child_features(feature)
if __name__ == '__main__':
fname = "KML_Samples.kml"
k = kml.KML()
with open(fname) as kmlFile:
k.from_string(kmlFile.read())
print_child_features(k)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment