Mercurial > dive4elements > river
diff flys-backend/contrib/shpimporter/uesg.py @ 5296:55122db34cd0
merge
author | Bettina Gruenbauer <bettina@intevation.de> |
---|---|
date | Thu, 14 Mar 2013 12:53:36 +0100 |
parents | 3f35d9db48c1 |
children |
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/uesg.py Thu Mar 14 12:49:41 2013 +0100 +++ b/flys-backend/contrib/shpimporter/uesg.py Thu Mar 14 12:53:36 2013 +0100 @@ -4,7 +4,8 @@ import ogr from importer import Importer - +import os.path +import utils TABLE_NAME="floodmaps" PATH="Hydrologie/UeSG" @@ -26,11 +27,8 @@ def isGeometryValid(self, geomType): - if geomType == 3 or geomType == 6: - return True - else: - return False - + return geomType in [ogr.wkbMultiPolygon, + ogr.wkbPolygon] def getKind(self, path): kind = 0 @@ -54,7 +52,6 @@ def createNewFeature(self, featureDef, feat, **args): kind = self.getKind(args['path']) - newFeat = ogr.Feature(featureDef) newFeat.SetGeometry(feat.GetGeometryRef()) @@ -83,6 +80,11 @@ else: perimeter = 0 + if kind >= 200: + newFeat.SetField("source", + os.path.basename(os.path.dirname(args['path']))) + + groupId = 2 newFeat.SetField("river_id", riverId) @@ -93,5 +95,5 @@ newFeat.SetField("kind", kind) newFeat.SetField("name", args['name']) - return newFeat + return utils.convertToMultiPolygon(newFeat)