comparison flys-backend/contrib/shpimporter/floodplains.py @ 2861:b0132e1b9719

Added further shape importers and added the option to reproject shapes during the import process. flys-backend/trunk@4342 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 03 May 2012 14:19:52 +0000
parents
children 59ca5dab2782
comparison
equal deleted inserted replaced
2860:2f874d14ac68 2861:b0132e1b9719
1 import ogr
2
3 from importer import Importer
4
5 TABLE_NAME="floodplain"
6 PATH="Hydrologie/Hydr.Grenzen"
7
8
9 class Floodplain(Importer):
10
11 def getPath(self, base):
12 return "%s/%s" % (base, PATH)
13
14
15 def getTablename(self):
16 return TABLE_NAME
17
18
19 def isGeometryValid(self, geomType):
20 return geomType == 3 or geomType == 6
21
22
23 def isShapeRelevant(self, name, path):
24 return name.find("talaue") >= 0
25
26
27 def createNewFeature(self, featureDef, feat, **args):
28 newFeat = ogr.Feature(featureDef)
29 geometry = feat.GetGeometryRef()
30
31 newFeat.SetGeometry(geometry)
32 newFeat.SetField("name", args['name'])
33
34 if self.IsFieldSet(feat, "river_id"):
35 newFeat.SetField("river_id", feat.GetField("river_id"))
36 else:
37 newFeat.SetField("river_id", self.river_id)
38
39 return newFeat
40

http://dive4elements.wald.intevation.org