comparison flys-backend/contrib/shpimporter/importer.py @ 4970:174fbaa3d344 dami

Add handling of River Names and remove target_src parameter This is the first step to make the shpimporter into a more generic geo importer that communicates directly (not only over ogr) with the database. Untested with Oracle
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 13 Feb 2013 12:02:30 +0100
parents 23a090b41543
children a92241d40228
comparison
equal deleted inserted replaced
4963:1469066cc7d9 4970:174fbaa3d344
7 import utils 7 import utils
8 import re 8 import re
9 9
10 class Importer: 10 class Importer:
11 11
12 def __init__(self, config, dbconn): 12 def __init__(self, river_id, dbconn, dry_run):
13 self.config = config 13 self.river_id = river_id
14 self.dbconn = dbconn 14 self.dbconn = dbconn
15 self.river_id = config.river_id 15 self.dry_run = dry_run
16 self.dest_srs = osr.SpatialReference() 16 self.dest_srs = osr.SpatialReference()
17 self.dest_srs.ImportFromEPSG(config.target_srs) 17 self.dest_srs.ImportFromEPSG(31467)
18 self.handled_fields = [] 18 self.handled_fields = []
19 self.tracking_import = False 19 self.tracking_import = False
20 self.srcLayer = None 20 self.srcLayer = None
21 21
22 def getKind(self, path): 22 def getKind(self, path):
217 if len(unhandled): 217 if len(unhandled):
218 shpimporter.INFO("Did not import values from fields: %s " % \ 218 shpimporter.INFO("Did not import values from fields: %s " % \
219 " ".join(unhandled)) 219 " ".join(unhandled))
220 220
221 try: 221 try:
222 if self.config.dry_run > 0: 222 if self.dry_run:
223 return geomType 223 return geomType
224 destLayer.CommitTransaction() 224 destLayer.CommitTransaction()
225 except e: 225 except e:
226 shpimporter.ERROR("Exception while committing transaction.") 226 shpimporter.ERROR("Exception while committing transaction.")
227 227

http://dive4elements.wald.intevation.org