예제 #1
0
 def test_sources_with_mixed_support_for_meta_tiles(self):
     self.source_base.supports_meta_tiles = False
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache,
         [self.source_base, self.source_overlay], 'png',
         meta_size=[2, 2], meta_buffer=0,
         locker=self.locker)
예제 #2
0
    def test_get_map_with_res_range(self):
        res_range = resolution_range(1000, 10)
        self.source = WMSSource(self.client, res_range=res_range)
        self.locker = TileLocker(tmp_lock_dir, 10, "id")
        self.tile_mgr = TileManager(self.grid,
                                    self.file_cache, [self.source],
                                    'png',
                                    meta_size=[2, 2],
                                    meta_buffer=0,
                                    image_opts=self.image_opts,
                                    locker=self.locker)
        self.layer = CacheMapLayer(self.tile_mgr,
                                   image_opts=default_image_opts)

        try:
            result = self.layer.get_map(
                MapQuery(
                    (-20037508.34, -20037508.34, 20037508.34, 20037508.34),
                    (500, 500), SRS(900913), 'png'))
        except BlankImage:
            pass
        else:
            assert False, 'expected BlankImage exception'
        eq_(self.file_cache.stored_tiles, set())

        result = self.layer.get_map(
            MapQuery((0, 0, 10000, 10000), (50, 50), SRS(900913), 'png'))
        eq_(
            self.file_cache.stored_tiles,
            set([(512, 257, 10), (513, 256, 10), (512, 256, 10),
                 (513, 257, 10)]))
        eq_(result.size, (50, 50))
예제 #3
0
 def setup(self):
     self.cache_dir = tempfile.mkdtemp()
     self.file_cache = FileCache(cache_dir=self.cache_dir, file_ext='png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockTileClient()
     self.source = TiledSource(self.grid, self.client)
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png', locker=self.locker)
예제 #4
0
 def setup(self):
     self.file_cache = MockFileCache('/dev/null', 'png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockWMSClient()
     self.source = WMSSource(self.client)
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png',
         meta_size=[2, 2], meta_buffer=10, minimize_meta_requests=True,
         locker=self.locker,
     )
예제 #5
0
 def setup(self):
     self.file_cache = MockFileCache('/dev/null', 'png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.source = MockSource()
     self.image_opts = ImageOptions(format='image/png')
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png',
         image_opts=self.image_opts,
         locker=self.locker,
     )
예제 #6
0
 def setup(self):
     self.file_cache = MockFileCache('/dev/null', 'png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockWMSClient()
     self.source = WMSSource(self.client)
     self.image_opts = ImageOptions(resampling='nearest')
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png',
         meta_size=[2, 2], meta_buffer=0, image_opts=self.image_opts,
         locker=self.locker)
     self.layer = CacheMapLayer(self.tile_mgr, image_opts=default_image_opts)
예제 #7
0
 def setup(self):
     self.tile_dir = tempfile.mkdtemp()
     self.file_cache = MockFileCache(self.tile_dir, 'png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.source = SlowMockSource()
     self.image_opts = ImageOptions(format='image/png')
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png',
         meta_size=[2, 2], meta_buffer=0, image_opts=self.image_opts,
         locker=self.locker,
     )
예제 #8
0
 def setup(self):
     self.file_cache = MockFileCache('/dev/null', 'png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.source_base = SolidColorMockSource(color='#ff0000')
     self.source_base.supports_meta_tiles = True
     self.source_overlay = MockSource()
     self.source_overlay.supports_meta_tiles = True
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache,
         [self.source_base, self.source_overlay], 'png',
         meta_size=[2, 2], meta_buffer=0,
         locker=self.locker,
     )
예제 #9
0
 def setup(self):
     self.file_cache = MockFileCache('/dev/null',
                                     'png',
                                     lock_dir=tmp_lock_dir)
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockWMSClient()
     self.source = WMSSource(self.client)
     self.image_opts = ImageOptions(format='image/png')
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(
         self.grid,
         self.file_cache,
         [self.source],
         'png',
         meta_size=[2, 2],
         meta_buffer=0,
         image_opts=self.image_opts,
         locker=self.locker,
     )
예제 #10
0
def tile_locker(tmpdir):
    return TileLocker(tmpdir.join('lock').strpath, 10, "id")