ingo@2853: import ogr ingo@2853: ingo@2853: from importer import Importer ingo@2853: ingo@2853: TABLE_NAME="lines" ingo@2853: PATH="Geodaesie/Linien" ingo@2853: ingo@2853: ingo@2853: class Line(Importer): ingo@2853: ingo@2853: def getPath(self, base): ingo@2853: return "%s/%s" % (base, PATH) ingo@2853: ingo@2853: ingo@2853: def getTablename(self): ingo@2853: return TABLE_NAME ingo@2853: ingo@2853: ingo@2853: def isGeometryValid(self, geomType): ingo@2853: return geomType == 2 ingo@2853: ingo@2853: ingo@2853: def isShapeRelevant(self, name, path): ingo@2853: return True ingo@2853: ingo@2853: ingo@2853: def createNewFeature(self, featureDef, feat, **args): ingo@2853: newFeat = ogr.Feature(featureDef) ingo@2853: newFeat.SetGeometry(feat.GetGeometryRef()) ingo@2853: ingo@2853: if self.IsFieldSet(feat, "river_id"): ingo@2853: newFeat.SetField("river_id", feat.GetField("river_id")) ingo@2853: else: ingo@2853: newFeat.SetField("river_id", self.river_id) ingo@2853: ingo@2853: if self.IsFieldSet(feat, "TYP"): ingo@2853: newFeat.SetField("kind", feat.GetFieldAsDouble("TYP")) ingo@2853: else: ingo@2853: return None ingo@2853: ingo@2853: if self.IsFieldSet(feat, "Z"): ingo@2853: newFeat.SetField("z", feat.GetFieldAsDouble("Z")) ingo@2853: else: ingo@2853: newFeat.SetField("z", 0) ingo@2853: ingo@2853: return newFeat ingo@2853: