Esempio n. 1
0
    def init_config(osm_file=None, dst=None, analyser_options=None):
        import osmose_run
        import osmose_config
        conf = osmose_config.template_config("test",
                                             analyser_options=analyser_options)
        conf.db_host = "localhost"
        conf.db_base = "osmose_test"
        conf.db_schema = conf.country
        conf.download["dst"] = osm_file
        conf.init()

        analyser_conf = osmose_run.analyser_config()
        analyser_conf.polygon_id = None
        analyser_conf.options = conf.analyser_options
        analyser_conf.dst = dst

        return (conf, analyser_conf)
Esempio n. 2
0
    def init_config(osm_file=None, dst=None, analyser_options=None):
        import os
        import osmose_run
        import osmose_config
        conf = osmose_config.template_config("test", analyser_options=analyser_options)
        conf.db_host = os.environ.get('DB_HOST', 'localhost')
        conf.db_base = os.environ.get('DB_BASE_TEST', 'osmose_test')
        conf.db_schema = conf.country
        conf.download["dst"] = osm_file
        conf.init()

        analyser_conf = osmose_run.analyser_config()
        analyser_conf.polygon_id = None
        analyser_conf.options = conf.analyser_options
        analyser_conf.dst = dst

        return (conf, analyser_conf)
Esempio n. 3
0
    def init_config(osm_file=None, dst=None, analyser_options=None):
        import os
        import osmose_run
        import osmose_config
        conf = osmose_config.template_config("test", analyser_options=analyser_options)
        conf.db_host = os.environ.get('DB_HOST', 'localhost')
        conf.db_base = os.environ.get('DB_BASE_TEST', 'osmose_test')
        conf.db_schema = conf.country
        conf.download["dst"] = osm_file
        conf.init()

        analyser_conf = osmose_run.analyser_config()
        analyser_conf.polygon_id = None
        analyser_conf.options = conf.analyser_options
        analyser_conf.dst = dst

        return (conf, analyser_conf)
Esempio n. 4
0
    def init_config(osm_file=None, dst=None, analyser_options=None):
        import osmose_run
        import osmose_config
        conf = osmose_config.template_config("test", analyser_options=analyser_options)
        conf.db_base = "osmose_test"
        conf.db_schema = conf.country
        conf.download["osmosis"] = "test"
        conf.download["dst"] = osm_file
        conf.init()

        analyser_conf = osmose_run.analyser_config()
        analyser_conf.db_string = conf.db_string
        analyser_conf.db_user = conf.db_user
        analyser_conf.db_schema = conf.db_schema
        analyser_conf.polygon_id = None
        analyser_conf.options = conf.analyser_options
        analyser_conf.dst = dst

        return (conf, analyser_conf)
Esempio n. 5
0
    def init_config(osm_file=None, dst=None, analyser_options=None):
        import os
        import osmose_run
        import osmose_config
        conf = osmose_config.template_config("test", analyser_options=analyser_options)
        conf.db_host = os.environ.get('DB_HOST', 'localhost')
        conf.db_base = os.environ.get('DB_BASE_TEST', 'osmose_test')
        conf.db_schema = conf.country
        conf.download["dst"] = osm_file
        conf.init()

        class options:
            plugin = None
            verbose = False
            change = False
        analyser_conf = osmose_run.analyser_config(conf, options(), None)
        analyser_conf.error_file = IssuesFileOsmose.IssuesFileOsmose(dst)

        return (conf, analyser_conf)
Esempio n. 6
0
def run(conf, analyser, plugin=None, format='osmose'):
    from optparse import Values
    options = Values({
        'verbose': False,
        'plugin': plugin and [plugin] or [],
        'change': False,
    })

    LOG = StringIO()
    logger = OsmoseLog.logger(LOG, True)

    osmosis_manager = modules.OsmOsisManager.OsmOsisManager(
        conf, conf.db_host, conf.db_user, conf.db_password, conf.db_base,
        conf.db_schema or conf.country, conf.db_persistent, logger)
    analyser_conf = analyser_config(conf, options, osmosis_manager)

    output = StringIO()
    analyser_conf.error_file = issues_file_from_fromat(output, format)

    with analyser(analyser_conf, logger.sub()) as analyser_obj:
        analyser_obj.analyser()

    return output.getvalue()