X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FKML.py;h=9b589ad582c0ac4f11c16a775222716bf7fa1d2f;hb=3bc9f5d2b4196fce972776f38856da05817e7364;hp=1f42898d6d4f48070381e93da2113a2b6af422a2;hpb=036e4f51e67820e245ae761b5cdf1169ab3b2c36;p=dead%2Fcensus-tools.git
diff --git a/src/KML.py b/src/KML.py
index 1f42898..9b589ad 100644
--- a/src/KML.py
+++ b/src/KML.py
@@ -32,17 +32,17 @@ class KmlObject(object):
def to_kml(self):
- return self.render()
+ kml = self.OPEN_TAG
+ kml += self.render()
+ kml += self.CLOSE_TAG + "\n"
+ return kml
def render(self):
- kml = self.OPEN_TAG
- kml += escape(self.text)
+ kml = escape(self.text)
for c in self.children:
kml += c.to_kml()
-
- kml += self.CLOSE_TAG + "\n"
return kml
@@ -75,7 +75,7 @@ class Document(KmlObject):
"""
CLOSE_TAG = """
- """
+"""
def __init__(self, initial_text=''):
super(Document, self).__init__(initial_text)
@@ -110,6 +110,12 @@ class Description(KmlObject):
+class Coordinates(KmlObject):
+
+ OPEN_TAG = ''
+ CLOSE_TAG = ''
+
+
class LineString(KmlObject):
OPEN_TAG = ''
@@ -140,9 +146,9 @@ class LineString(KmlObject):
coords = []
for ls in linestrings:
- c_tag_start = ls.find('')
- c_start = c_tag_start + len('')
- c_end = ls.find('')
+ c_tag_start = ls.find(Coordinates.OPEN_TAG)
+ c_start = c_tag_start + len(Coordinates.OPEN_TAG)
+ c_end = ls.find(Coordinates.CLOSE_TAG)
c = ls[ c_start : c_end ]
coords.append(c)