Exemple #1
0
def format_seed_task(task):
    info = []
    info.append('  %s:' % (task.md['name'], ))
    if task.coverage is False:
        info.append("    Empty coverage given for this task")
        info.append("    Skipped")
        return '\n'.join(info)

    info.append("    Seeding cache '%s' with grid '%s' in %s" % (
                 task.md['cache_name'], task.md['grid_name'], task.grid.srs.srs_code))
    if task.coverage:
        info.append('    Limited to coverage in: %s (EPSG:4326)' % (format_bbox(task.coverage.extent.llbbox), ))
    else:
        info.append('   Complete grid: %s (EPSG:4326)' % (format_bbox(map_extent_from_grid(task.grid).llbbox), ))
    info.append('    Levels: %s' % (task.levels, ))

    if task.refresh_timestamp:
        info.append('    Overwriting: tiles older than %s' %
                    datetime.fromtimestamp(task.refresh_timestamp))
    elif task.refresh_timestamp == 0:
        info.append('    Overwriting: all tiles')
    else:
        info.append('    Overwriting: no tiles')

    return '\n'.join(info)
Exemple #2
0
def format_cleanup_task(task):
    info = []
    info.append('  %s:' % (task.md['name'], ))
    if task.coverage is False:
        info.append("    Empty coverage given for this task")
        info.append("    Skipped")
        return '\n'.join(info)

    info.append(
        "    Cleaning up cache '%s' with grid '%s' in %s" %
        (task.md['cache_name'], task.md['grid_name'], task.grid.srs.srs_code))
    if task.coverage:
        info.append('    Limited to coverage in: %s (EPSG:4326)' %
                    (format_bbox(task.coverage.extent.llbbox), ))
    else:
        info.append('    Complete grid: %s (EPSG:4326)' %
                    (format_bbox(map_extent_from_grid(task.grid).llbbox), ))
    info.append('    Levels: %s' % (task.levels, ))

    if task.remove_timestamp:
        info.append('    Remove: tiles older than %s' %
                    datetime.fromtimestamp(task.remove_timestamp))
    else:
        info.append('    Remove: all tiles')

    return '\n'.join(info)
Exemple #3
0
 def __init__(self, grid, client, coverage=None, image_opts=None, error_handler=None):
     Source.__init__(self, image_opts=image_opts)
     self.grid = grid
     self.client = client
     self.image_opts = image_opts or ImageOptions()
     self.coverage = coverage
     self.extent = coverage.extent if coverage else map_extent_from_grid(grid)
     self.error_handler = error_handler
Exemple #4
0
 def __init__(self, name, title, md, tile_manager):
     """
     :param md: the layer metadata
     :param tile_manager: the layer tile manager
     """
     self.name = name
     self.title = title
     self.md = md
     self.tile_manager = tile_manager
     self.grid = TileServiceGrid(tile_manager.grid)
     self.extent = map_extent_from_grid(self.grid)
     self._empty_tile = None
Exemple #5
0
 def __init__(self, name, title, md, tile_manager):
     """
     :param md: the layer metadata
     :param tile_manager: the layer tile manager
     """
     self.name = name
     self.title = title
     self.md = md
     self.tile_manager = tile_manager
     self.grid = TileServiceGrid(tile_manager.grid)
     self.extent = map_extent_from_grid(self.grid)
     self._empty_tile = None
     self._mixed_format = True if self.md.get('format', False) == 'mixed' else False
Exemple #6
0
 def __init__(self,
              grid,
              client,
              coverage=None,
              image_opts=None,
              error_handler=None):
     Source.__init__(self, image_opts=image_opts)
     self.grid = grid
     self.client = client
     self.image_opts = image_opts or ImageOptions()
     self.coverage = coverage
     self.extent = coverage.extent if coverage else map_extent_from_grid(
         grid)
     self.error_handler = error_handler
Exemple #7
0
 def __init__(self, name, title, md, tile_manager):
     """
     :param md: the layer metadata
     :param tile_manager: the layer tile manager
     """
     self.name = name
     self.title = title
     self.md = md
     self.tile_manager = tile_manager
     self.grid = TileServiceGrid(tile_manager.grid)
     self.extent = map_extent_from_grid(self.grid)
     self._empty_tile = None
     self._mixed_format = True if self.md.get('format',
                                              False) == 'mixed' else False
Exemple #8
0
def format_cleanup_task(task):
    info = []
    info.append('  %s:' % (task.md['name'], ))
    info.append("    Cleaning up cache '%s' with grid '%s' in %s" % (
                 task.md['cache_name'], task.md['grid_name'], task.grid.srs.srs_code))
    if task.coverage:
        info.append('    Limited to: %s (EPSG:4326)' % (format_bbox(task.coverage.extent.llbbox), ))
    else:
        info.append('    Complete grid: %s (EPSG:4326)' % (format_bbox(map_extent_from_grid(task.grid).llbbox), ))
    info.append('    Levels: %s' % (task.levels, ))

    if task.remove_timestamp:
        info.append('    Remove: tiles older than %s' %
                    datetime.fromtimestamp(task.remove_timestamp))
    else:
        info.append('    Remove: all tiles')

    return '\n'.join(info)
Exemple #9
0
def format_seed_task(task):
    info = []
    info.append('  %s:' % (task.md['name'], ))
    info.append("    Seeding cache '%s' with grid '%s' in %s" % (
                 task.md['cache_name'], task.md['grid_name'], task.grid.srs.srs_code))
    if task.coverage:
        info.append('    Limited to: %s (EPSG:4326)' % (format_bbox(task.coverage.extent.llbbox), ))
    else:
        info.append('   Complete grid: %s (EPSG:4326)' % (format_bbox(map_extent_from_grid(task.grid).llbbox), ))
    info.append('    Levels: %s' % (task.levels, ))

    if task.refresh_timestamp:
        info.append('    Overwriting: tiles older than %s' %
                    datetime.fromtimestamp(task.refresh_timestamp))
    elif task.refresh_timestamp == 0:
        info.append('    Overwriting: all tiles')
    else:
        info.append('    Overwriting: no tiles')

    return '\n'.join(info)
Exemple #10
0
 def __init__(self,
              name,
              title,
              md,
              tile_manager,
              info_sources=[],
              dimensions=None):
     """
     :param md: the layer metadata
     :param tile_manager: the layer tile manager
     """
     self.name = name
     self.title = title
     self.md = md
     self.tile_manager = tile_manager
     self.info_sources = info_sources
     self.dimensions = dimensions
     self.grid = TileServiceGrid(tile_manager.grid)
     self.extent = map_extent_from_grid(self.grid)
     self._empty_tile = None
     self._mixed_format = True if self.md.get('format',
                                              False) == 'mixed' else False
     self.empty_response_as_png = True