comparison 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
comparison
equal deleted inserted replaced
5136:ec3430d12d2e 5137:04eb62eae722
178 178
179 def getName(self): 179 def getName(self):
180 return "HWS_LINES" 180 return "HWS_LINES"
181 181
182 def isGeometryValid(self, geomType): 182 def isGeometryValid(self, geomType):
183 return geomType == ogr.wkbLineString or geomType == ogr.wkbLineString25D 183 return geomType in [ogr.wkbLineString,
184 ogr.wkbLineString25D,
185 ogr.wkbMultiLineString25D,
186 ogr.wkbMultiLineString]
184 187
185 def isShapeRelevant(self, name, path): 188 def isShapeRelevant(self, name, path):
186 shp = ogr.Open(path) 189 shp = ogr.Open(path)
187 return self.isGeometryValid(shp.GetLayerByName(name).GetGeomType()) 190 return self.isGeometryValid(shp.GetLayerByName(name).GetGeomType())
188 191
189 def createNewFeature(self, featureDef, feat, **args): 192 def createNewFeature(self, featureDef, feat, **args):
190 newFeat = HWSPoints.createNewFeature(self, featureDef, feat, **args) 193 newFeat = HWSPoints.createNewFeature(self, featureDef, feat, **args)
191 geometry = feat.GetGeometryRef() 194 geometry = feat.GetGeometryRef()
192 geometry.SetCoordinateDimension(3) 195 if geometry.GetCoordinateDimension() == 2:
196 geometry.SetCoordinateDimension(3)
193 newFeat.SetGeometry(geometry) 197 newFeat.SetGeometry(geometry)
194 198
195 return newFeat 199 return utils.convertToMultiLine(newFeat)
196 200
197 201

http://dive4elements.wald.intevation.org