Пример #1
0
def create_couchdb_export_cache(export_path, db_name, file_ext, couchdb_port, app_state):
    md_template = CouchDBMDTemplate({})
    cache_dir = app_state.user_temp_dir()
    url = 'http://%s:%s' % ('127.0.0.1', couchdb_port)

    return CouchDBCache(url=url, db_name=db_name, md_template=md_template,
        lock_dir=cache_dir, file_ext=file_ext, tile_grid=DEFAULT_GRID)
Пример #2
0
def create_couchdb_cache(app_state, task=False, layer=False):
    cache_dir = app_state.user_temp_dir()

    if task:
        db_name = task.layer.name
        file_ext = task.source.format
    if layer:
        gbi_server = layer.gbi_server
        if gbi_server is not None:
            gbi_server.app_state = app_state
            db_name = gbi_server.raster_prefix + layer.name
        else:
            db_name = "%s_%s_%s" % (layer.prefix,
                                    app_state.config.get(
                                        'app', 'raster_prefix'), layer.name)
        file_ext = layer.format

    port = app_state.config.get('couchdb', 'port')
    url = 'http://127.0.0.1:%s' % (port, )

    md_template = CouchDBMDTemplate({})

    return CouchDBCache(url=url,
                        db_name=db_name,
                        md_template=md_template,
                        lock_dir=cache_dir,
                        file_ext=file_ext,
                        tile_grid=DEFAULT_GRID)
Пример #3
0
def create_couchdb_cache(wmts_source, app_state):
    cache_dir = app_state.user_temp_dir()

    db_name = wmts_source.name
    file_ext = wmts_source.format
    port = app_state.config.get('couchdb', 'port')
    url = 'http://127.0.0.1:%s' % (port, )

    md_template = CouchDBMDTemplate({})

    return CouchDBCache(url=url, db_name=db_name, md_template=md_template,
        lock_dir=cache_dir, file_ext=file_ext, tile_grid=DEFAULT_GRID)
Пример #4
0
    def setup(self):
        if not os.environ.get('MAPPROXY_TEST_COUCHDB'):
            raise SkipTest()

        couch_address = os.environ['MAPPROXY_TEST_COUCHDB']
        db_name = 'mapproxy_test_%d' % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        md_template = CouchDBMDTemplate({'row': '{{y}}', 'tile_column': '{{x}}',
            'zoom': '{{level}}', 'time': '{{timestamp}}', 'coord': '{{wgs_tile_centroid}}'})
        self.cache = CouchDBCache(couch_address, db_name,
            file_ext='png', tile_grid=tile_grid(3857, name='global-webmarcator'),
            md_template=md_template)