comparison backend/contrib/shpimporter/axis.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/axis.py@f52bb7178eda
children f1aeb6a60380
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 import utils
8
9 NAME="Axis"
10 TABLE_NAME="river_axes"
11 PATH="Geodaesie/Flussachse+km"
12
13
14 class Axis(Importer):
15
16 def getPath(self, base):
17 return "%s/%s" % (base, PATH)
18
19
20 def getTablename(self):
21 return TABLE_NAME
22
23
24 def getName(self):
25 return NAME
26
27
28 def isGeometryValid(self, geomType):
29 return geomType in [ogr.wkbLineString,
30 ogr.wkbLineString25D,
31 ogr.wkbMultiLineString25D,
32 ogr.wkbMultiLineString]
33
34 def isShapeRelevant(self, name, path):
35 return "km.shp" not in path.lower()
36
37
38 def createNewFeature(self, featureDef, feat, **args):
39 newFeat = ogr.Feature(featureDef)
40 geometry = feat.GetGeometryRef()
41 geometry.SetCoordinateDimension(3)
42 newFeat.SetGeometry(geometry)
43 newFeat.SetField("name", args['name'])
44
45 if self.IsFieldSet(feat, "river_id"):
46 riverId = feat.GetField("river_id")
47 else:
48 riverId = self.river_id
49
50 newFeat.SetField("river_id", riverId)
51 if args.get("name", "").lower() == "achse":
52 newFeat.SetField("kind_id", 1) # 1 is Current
53 else:
54 newFeat.SetField("kind_id", 2) # 2 Is Other
55
56 return utils.convertToMultiLine(newFeat)

http://dive4elements.wald.intevation.org