comparison flys-backend/contrib/shpimporter/shpimporter.py @ 4871:890eaa0a5162

Add ogr_connection parameter to allow directly setting the ogr connection. This allows the importer to connect with all supported and not just OCI
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 23 Jan 2013 11:51:14 +0100
parents 8654e4480fc6
children a563e9f58f93
comparison
equal deleted inserted replaced
4870:2dac0e5b927e 4871:890eaa0a5162
61 parser.add_option("--user", type="string") 61 parser.add_option("--user", type="string")
62 parser.add_option("--password", type="string") 62 parser.add_option("--password", type="string")
63 parser.add_option("--river_id", type="int") 63 parser.add_option("--river_id", type="int")
64 parser.add_option("--verbose", type="int", default=1) 64 parser.add_option("--verbose", type="int", default=1)
65 parser.add_option("--dry_run", type="int", default=0) 65 parser.add_option("--dry_run", type="int", default=0)
66 parser.add_option("--ogr_connection", type="string")
66 parser.add_option("--skip_axis", type="int") 67 parser.add_option("--skip_axis", type="int")
67 parser.add_option("--skip_hydr_boundaries", type="int") 68 parser.add_option("--skip_hydr_boundaries", type="int")
68 parser.add_option("--skip_buildings", type="int") 69 parser.add_option("--skip_buildings", type="int")
69 parser.add_option("--skip_crosssections", type="int") 70 parser.add_option("--skip_crosssections", type="int")
70 parser.add_option("--skip_lines", type="int") 71 parser.add_option("--skip_lines", type="int")
78 (config, args) = parser.parse_args() 79 (config, args) = parser.parse_args()
79 80
80 if config.directory == None: 81 if config.directory == None:
81 ERROR("No river directory specified!") 82 ERROR("No river directory specified!")
82 raise Exception("Invalid config") 83 raise Exception("Invalid config")
83 elif config.host == None: 84 if not config.ogr_connection:
84 ERROR("No database host specified!") 85 if not config.host:
85 raise Exception("Invalid config") 86 ERROR("No database host specified!")
86 elif config.user == None: 87 raise Exception("Invalid config")
87 ERROR("No databaser user specified!") 88 if not config.user:
88 raise Exception("Invalid config") 89 ERROR("No databaser user specified!")
89 elif config.password == None: 90 raise Exception("Invalid config")
90 ERROR("No password specified!") 91 if not config.password:
91 raise Exception("Invalid config") 92 ERROR("No password specified!")
92 elif config.river_id == None: 93 raise Exception("Invalid config")
94 if config.river_id == None:
93 ERROR("No river id specified!") 95 ERROR("No river id specified!")
94 raise Exception("Invalid config") 96 raise Exception("Invalid config")
95 97
96 return config 98 return config
97 99

http://dive4elements.wald.intevation.org