]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Added a Coordinates class, and updated the LineString class to refer to Coordinates...
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 13 Feb 2010 05:41:01 +0000 (00:41 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 13 Feb 2010 05:41:01 +0000 (00:41 -0500)
src/KML.py

index 26e8e71d551437caa72617c52bdfe7ce41717774..9b589ad582c0ac4f11c16a775222716bf7fa1d2f 100644 (file)
@@ -110,6 +110,12 @@ class Description(KmlObject):
 
 
 
+class Coordinates(KmlObject):
+
+    OPEN_TAG = '<coordinates>'
+    CLOSE_TAG = '</coordinates>'
+
+
 class LineString(KmlObject):
 
     OPEN_TAG = '<LineString>'
@@ -140,9 +146,9 @@ class LineString(KmlObject):
         coords = []
 
         for ls in linestrings:
-            c_tag_start = ls.find('<coordinates>')
-            c_start = c_tag_start + len('<coordinates>')
-            c_end = ls.find('</coordinates>')
+            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)