comparison flys-backend/contrib/shpimporter/axis.py @ 3800:69d19995bc3c 2.9.1

merged flys-backend/2.9.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:48 +0200
parents c37effda3655
children 23a090b41543
comparison
equal deleted inserted replaced
3786:4adc35aa655c 3800:69d19995bc3c
1 import ogr
2
3 from importer import Importer
4 import shpimporter
5
6 NAME="Axis"
7 TABLE_NAME="river_axes"
8 PATH="Geodaesie/Flussachse+km"
9
10
11 class Axis(Importer):
12
13 def getPath(self, base):
14 return "%s/%s" % (base, PATH)
15
16
17 def getTablename(self):
18 return TABLE_NAME
19
20
21 def getName(self):
22 return NAME
23
24
25 def isGeometryValid(self, geomType):
26 return geomType == 2
27
28
29 def isShapeRelevant(self, name, path):
30 return name == "achse" or name.find("achse") >= 0
31
32
33 def createNewFeature(self, featureDef, feat, **args):
34 newFeat = ogr.Feature(featureDef)
35 newFeat.SetGeometry(feat.GetGeometryRef())
36 newFeat.SetField("name", args['name'])
37
38 if self.IsFieldSet(feat, "river_id"):
39 riverId = feat.GetField("river_id")
40 else:
41 riverId = self.river_id
42
43 if self.IsFieldSet(feat, "kind"):
44 kind = feat.GetField("kind")
45 else:
46 kind = 0
47
48 newFeat.SetField("river_id", riverId)
49 newFeat.SetField("kind", kind)
50
51 return newFeat
52

http://dive4elements.wald.intevation.org