diff flys-backend/contrib/shpimporter/boundaries.py @ 5182:8aac391871f9

SCHEME CHANGE: Hydr.Boundaries are now three dimensional multilinestrings
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 07 Mar 2013 10:53:44 +0100
parents c5187ab9f571
children 71a24278322c
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/boundaries.py	Thu Mar 07 10:44:27 2013 +0100
+++ b/flys-backend/contrib/shpimporter/boundaries.py	Thu Mar 07 10:53:44 2013 +0100
@@ -4,6 +4,7 @@
     import ogr
 
 from importer import Importer
+import utils
 
 TABLE_NAME="hydr_boundaries"
 TABLE_NAME_POLY="hydr_boundaries_poly"
@@ -23,7 +24,10 @@
         return NAME
 
     def isGeometryValid(self, geomType):
-        return geomType == ogr.wkbLineString
+        return geomType in [ogr.wkbLineString,
+                            ogr.wkbLineString25D,
+                            ogr.wkbMultiLineString25D,
+                            ogr.wkbMultiLineString]
 
     def isShapeRelevant(self, name, path):
         shp = ogr.Open(path)
@@ -48,7 +52,7 @@
 
         newFeat  = ogr.Feature(featureDef)
         geometry = feat.GetGeometryRef()
-        geometry.SetCoordinateDimension(2)
+        geometry.SetCoordinateDimension(3)
 
         newFeat.SetGeometry(geometry)
         newFeat.SetField("name", args['name'])
@@ -64,7 +68,7 @@
         else:
             newFeat.SetField("river_id", self.river_id)
 
-        return newFeat
+        return utils.convertToMultiLine(newFeat)
 
 class HydrBoundaryPoly(HydrBoundary):
 

http://dive4elements.wald.intevation.org