Created
February 27, 2012 03:06
-
-
Save javierwilson/1921036 to your computer and use it in GitHub Desktop.
Reduce "resolucion" de un KML
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 re | |
f = open('municipio.kml', 'r') | |
line = f.readline() | |
while line: | |
rline = line.rstrip() | |
redata = re.match('<coordinates>(.*?)</coordinates>',line) | |
if redata: | |
rline = "<coordinates>" | |
data = redata.groups() | |
for datum in data: | |
coords = re.split(' ', datum) | |
i = 0 | |
for acoord in coords: | |
if i % 2 == 0: | |
rline = rline + ' ' + acoord | |
i = i+1 | |
rline = rline + "</coordinates>" | |
print rline | |
line = f.readline() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tal vez tambien debería reducir un par de decimales...