comparison flys-backend/contrib/shpimporter/buildings.py @ 3689:c938e568c4a2 2.9

merged flys-backend/2.9
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:44 +0200
parents 59ca5dab2782
children f1c01fecf194
comparison
equal deleted inserted replaced
3651:06a65baae494 3689:c938e568c4a2
1 import ogr
2
3 from importer import Importer
4
5 TABLE_NAME="buildings"
6 PATH="Geodaesie/Bauwerke"
7 NAME="Buildings"
8
9
10 class Building(Importer):
11
12 def getPath(self, base):
13 return "%s/%s" % (base, PATH)
14
15
16 def getTablename(self):
17 return TABLE_NAME
18
19
20 def getName(self):
21 return NAME
22
23
24 def isGeometryValid(self, geomType):
25 return geomType == 2
26
27
28 def isShapeRelevant(self, name, path):
29 return True
30
31
32 def createNewFeature(self, featureDef, feat, **args):
33 newFeat = ogr.Feature(featureDef)
34 newFeat.SetGeometry(feat.GetGeometryRef())
35
36 if self.IsFieldSet(feat, "river_id"):
37 newFeat.SetField("river_id", feat.GetField("river_id"))
38 else:
39 newFeat.SetField("river_id", self.river_id)
40
41 if self.IsFieldSet(feat, "Name"):
42 newFeat.SetField("name", feat.GetField("Name"))
43 elif self.IsFieldSet(feat, "KWNAAM"):
44 newFeat.SetField("name", feat.GetField("KWNAAM"))
45
46 return newFeat
47

http://dive4elements.wald.intevation.org