Created
          June 7, 2012 20:28 
        
      - 
      
- 
        Save uwekamper/2891355 to your computer and use it in GitHub Desktop. 
    Export placemarks from KML-file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/python | |
| import os, sys | |
| import xml.etree.ElementTree as ET | |
| tree = ET.parse("filename.kml") | |
| places = list(tree.iter('{http://earth.google.com/kml/2.0}Placemark')) | |
| print '"name", "longitude", "latidude", "elevation"' | |
| for p in places: | |
| name = p.find('{http://earth.google.com/kml/2.0}name').text | |
| point = p.find('{http://earth.google.com/kml/2.0}Point') | |
| coord= point.find('{http://earth.google.com/kml/2.0}coordinates') | |
| print '%s,' % name, coord.text | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment