comparison flys-backend/contrib/shpimporter/importer.py @ 3654:59ca5dab2782

Shape importer: use python's OptionParse to read user specific configuration from command line. flys-backend/trunk@5231 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Aug 2012 11:55:55 +0000
parents 998f1a7dcfde
children 8654e4480fc6
comparison
equal deleted inserted replaced
3653:20d249e1589f 3654:59ca5dab2782
1 import ogr, osr 1 import ogr, osr
2 2
3 class Importer: 3 class Importer:
4 4
5 def __init__(self, dbconn, river_id, dest_srs): 5 def __init__(self, config):
6 self.dbconn = dbconn 6 self.config = config
7 self.river_id = river_id 7 self.dbconn = 'OCI:%s/%s@%s' % (config.user, config.password, config.host)
8 self.river_id = config.river_id
8 self.dest_srs = osr.SpatialReference() 9 self.dest_srs = osr.SpatialReference()
9 self.dest_srs.ImportFromEPSG(dest_srs) 10 self.dest_srs.ImportFromEPSG(config.target_srs)
10 11
11 12
12 def getKind(self, path): 13 def getKind(self, path):
13 raise NotImplementedError("Importer.getKind is abstract!") 14 raise NotImplementedError("Importer.getKind is abstract!")
14 15
16 def getPath(self, base): 17 def getPath(self, base):
17 raise NotImplementedError("Importer.getPath is abstract!") 18 raise NotImplementedError("Importer.getPath is abstract!")
18 19
19 20
20 def getTablename(self): 21 def getTablename(self):
22 raise NotImplementedError("Importer.getTablename is abstract!")
23
24
25 def getName(self):
21 raise NotImplementedError("Importer.getTablename is abstract!") 26 raise NotImplementedError("Importer.getTablename is abstract!")
22 27
23 28
24 def IsFieldSet(self, feat, name): 29 def IsFieldSet(self, feat, name):
25 try: 30 try:

http://dive4elements.wald.intevation.org