diff flys-backend/contrib/shpimporter/utils.py @ 5137:04eb62eae722

River Axes and HWS_lines are now multiline
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 28 Feb 2013 12:58:25 +0100
parents c5187ab9f571
children 40dc001594e4
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/utils.py	Thu Feb 28 12:48:27 2013 +0100
+++ b/flys-backend/contrib/shpimporter/utils.py	Thu Feb 28 12:58:25 2013 +0100
@@ -97,3 +97,14 @@
 def getWkbString(type):
     return WKB_MAP.get(type) or "Unknown"
 
+def convertToMultiLine(feature):
+    """
+    Converts a feature to a multiline feature.
+    """
+    geometry = feature.GetGeometryRef()
+    # SRS information is lost while forcing to multiline
+    srs = geometry.GetSpatialReference()
+    geometry = ogr.ForceToMultiLineString(geometry)
+    geometry.AssignSpatialReference(srs)
+    feature.SetGeometry(geometry)
+    return feature

http://dive4elements.wald.intevation.org