comparison backend/contrib/shpimporter/floodplains.py @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-backend/contrib/shpimporter/floodplains.py@88e3473a3846
children e10bfd2d2a5d
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 try:
2 from osgeo import ogr
3 except ImportError:
4 import ogr
5
6 from importer import Importer
7
8 TABLE_NAME="floodplain"
9 PATH="Hydrologie/Hydr.Grenzen"
10 NAME="Floodplains"
11
12
13 class Floodplain(Importer):
14
15 def getPath(self, base):
16 return "%s/%s" % (base, PATH)
17
18
19 def getTablename(self):
20 return TABLE_NAME
21
22
23 def getName(self):
24 return NAME
25
26
27 def isGeometryValid(self, geomType):
28 return geomType == 3 or geomType == 6
29
30
31 def isShapeRelevant(self, name, path):
32 return name.find("talaue") >= 0
33
34
35 def createNewFeature(self, featureDef, feat, **args):
36 newFeat = ogr.Feature(featureDef)
37 geometry = feat.GetGeometryRef()
38
39 newFeat.SetGeometry(geometry)
40 newFeat.SetField("name", args['name'])
41
42 if args['path'].lower().endswith("/talaue.shp") and \
43 not "sonstige" in args['path'].lower():
44 newFeat.SetField("kind_id", 1) # offical
45 else:
46 newFeat.SetField("kind_id", 0) # misc
47
48 if self.IsFieldSet(feat, "river_id"):
49 newFeat.SetField("river_id", feat.GetField("river_id"))
50 else:
51 newFeat.SetField("river_id", self.river_id)
52
53 return newFeat
54

http://dive4elements.wald.intevation.org