Last active
December 14, 2015 05:09
-
-
Save Adrianod/5033553 to your computer and use it in GitHub Desktop.
Extract the KML polygons representing your LAS-order from Lantmäteriet.
This file contains 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
import xml.etree.ElementTree as ET | |
tree = ET.parse('las.kml') | |
root = tree.getroot()[0] | |
for pm in root.findall('{http://www.opengis.net/kml/2.2}Placemark'): | |
if pm[0].text != "selected_square_style": | |
root.remove(pm) | |
else: | |
pm.remove(pm[0]) | |
poly = pm[1] | |
poly.remove(poly[0]) | |
poly.remove(poly[0]) | |
poly.remove(poly[0]) | |
tree.write('out.kml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment