diff flys-backend/contrib/shpimporter/hws.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 5ba502e78e05
children 76db0e48dbc0
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/hws.py	Thu Feb 28 12:48:27 2013 +0100
+++ b/flys-backend/contrib/shpimporter/hws.py	Thu Feb 28 12:58:25 2013 +0100
@@ -180,7 +180,10 @@
         return "HWS_LINES"
 
     def isGeometryValid(self, geomType):
-        return geomType == ogr.wkbLineString or geomType == ogr.wkbLineString25D
+        return geomType in [ogr.wkbLineString,
+                            ogr.wkbLineString25D,
+                            ogr.wkbMultiLineString25D,
+                            ogr.wkbMultiLineString]
 
     def isShapeRelevant(self, name, path):
         shp = ogr.Open(path)
@@ -189,9 +192,10 @@
     def createNewFeature(self, featureDef, feat, **args):
         newFeat = HWSPoints.createNewFeature(self, featureDef, feat, **args)
         geometry = feat.GetGeometryRef()
-        geometry.SetCoordinateDimension(3)
+        if geometry.GetCoordinateDimension() == 2:
+            geometry.SetCoordinateDimension(3)
         newFeat.SetGeometry(geometry)
 
-        return newFeat
+        return utils.convertToMultiLine(newFeat)
 
 

http://dive4elements.wald.intevation.org