changeset 4879:63f82bdd45f8

(importer) Enable hws_* importers
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Jan 2013 10:47:19 +0100
parents 82d00b0c7302
children a5669cc576b4
files flys-backend/contrib/shpimporter/shpimporter.py
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/shpimporter.py	Fri Jan 25 10:46:00 2013 +0100
+++ b/flys-backend/contrib/shpimporter/shpimporter.py	Fri Jan 25 10:47:19 2013 +0100
@@ -14,7 +14,7 @@
 from crosssectiontracks import CrosssectionTrack
 from floodplains import Floodplain
 from boundaries import HydrBoundary, HydrBoundaryPoly
-from hws import HWS
+from hws import HWSLines, HWSPoints
 from gauges import GaugeLocation
 from catchments import Catchment
 
@@ -49,7 +49,8 @@
         Floodplain(config, dbconn),
         HydrBoundary(config, dbconn),
         HydrBoundaryPoly(config, dbconn),
-        HWS(config, dbconn),
+        HWSLines(config, dbconn),
+        HWSPoints(config, dbconn),
         GaugeLocation(config, dbconn),
         Catchment(config, dbconn),
         UESG(config, dbconn)
@@ -74,7 +75,8 @@
     parser.add_option("--skip_lines", type="int")
     parser.add_option("--skip_fixpoints", type="int")
     parser.add_option("--skip_floodplains", type="int")
-    parser.add_option("--skip_hws", type="int")
+    parser.add_option("--skip_hws_lines", type="int")
+    parser.add_option("--skip_hws_points", type="int")
     parser.add_option("--skip_gauge_locations", type="int")
     parser.add_option("--skip_catchments", type="int")
     parser.add_option("--skip_kms", type="int")
@@ -118,7 +120,9 @@
         return True
     elif config.skip_floodplains == 1 and isinstance(importer, Floodplain):
         return True
-    elif config.skip_hws == 1 and isinstance(importer, HWS):
+    elif config.skip_hws_points == 1 and isinstance(importer, HWSPoints):
+        return True
+    elif config.skip_hws_lines == 1 and isinstance(importer, HWSLines):
         return True
     elif config.skip_gauge_locations == 1 and isinstance(importer, GaugeLocation):
         return True
@@ -147,12 +151,14 @@
         INFO("You enable 'dry_run'. No database transaction will take place!")
 
     if config.ogr_connection:
-        dbconn = ogr.Open(config.ogr_connection)
+        connstr = config.ogr_connection
     else:
-        dbconn = ogr.Open('OCI:%s/%s@%s' % (config.user, config.password, config.host))
+        connstr = 'OCI:%s/%s@%s' % (config.user, config.password, config.host)
 
-    if not dbconn:
-        shpimporter.ERROR("Could not connect to database %s" % self.dbconn)
+    dbconn = ogr.Open(connstr)
+
+    if dbconn == None:
+        ERROR("Could not connect to database %s" % connstr)
         return -1
 
     importers = getImporters(config, dbconn)

http://dive4elements.wald.intevation.org