Ejemplo n.º 1
0
    def test_seed_with_res_list(self):
        # box from 10 10 to 80 80 with small spike/corner to -10 60 (upper left)
        geom = load_wkt(
            "POLYGON((10 10, 10 50, -10 60, 10 80, 80 80, 80 10, 10 10))")

        self.grid = TileGrid(
            SRS(4326),
            bbox=[-180, -90, 180, 90],
            res=[360 / 256, 360 / 720, 360 / 2000, 360 / 5000, 360 / 8000],
        )
        self.tile_mgr = TileManager(self.grid,
                                    MockCache(), [self.source],
                                    "png",
                                    locker=DummyLocker())
        task = self.make_geom_task(geom, SRS(4326), [0, 1, 2, 3, 4])
        seeder = TileWalker(task, self.seed_pool, handle_uncached=True)
        seeder.walk()

        assert len(self.seed_pool.seeded_tiles) == 5
        assert self.seed_pool.seeded_tiles[0] == set([(0, 0)])
        assert self.grid.grid_sizes[1] == (3, 2)
        assert self.seed_pool.seeded_tiles[1] == set([(1, 0), (1, 1), (2, 0),
                                                      (2, 1)])
        assert self.grid.grid_sizes[2] == (8, 4)
        assert self.seed_pool.seeded_tiles[2] == set([(4, 2), (5, 2), (4, 3),
                                                      (5, 3), (3, 3)])
        assert self.grid.grid_sizes[3] == (20, 10)
        assert len(self.seed_pool.seeded_tiles[3]) == 5 * 5 + 2
Ejemplo n.º 2
0
    def test_seed_with_res_list(self):
        if not load_wkt: raise SkipTest('no shapely installed')
        # box from 10 10 to 80 80 with small spike/corner to -10 60 (upper left)
        geom = load_wkt(
            "POLYGON((10 10, 10 50, -10 60, 10 80, 80 80, 80 10, 10 10))")

        self.grid = TileGrid(
            SRS(4326),
            bbox=[-180, -90, 180, 90],
            res=[360 / 256, 360 / 720, 360 / 2000, 360 / 5000, 360 / 8000])
        self.tile_mgr = TileManager(self.grid,
                                    MockCache(), [self.source],
                                    'png',
                                    locker=DummyLocker())
        task = self.make_geom_task(geom, SRS(4326), [0, 1, 2, 3, 4])
        seeder = TileWalker(task, self.seed_pool, handle_uncached=True)
        seeder.walk()

        eq_(len(self.seed_pool.seeded_tiles), 5)
        eq_(self.seed_pool.seeded_tiles[0], set([(0, 0)]))
        eq_(self.grid.grid_sizes[1], (3, 2))
        eq_(self.seed_pool.seeded_tiles[1],
            set([(1, 0), (1, 1), (2, 0), (2, 1)]))
        eq_(self.grid.grid_sizes[2], (8, 4))
        eq_(self.seed_pool.seeded_tiles[2],
            set([(4, 2), (5, 2), (4, 3), (5, 3), (3, 3)]))
        eq_(self.grid.grid_sizes[3], (20, 10))
        eq_(len(self.seed_pool.seeded_tiles[3]), 5 * 5 + 2)
Ejemplo n.º 3
0
 def setup(self):
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.source = TiledSource(self.grid, None)
     self.tile_mgr = TileManager(self.grid,
                                 MockCache(), [self.source],
                                 "png",
                                 locker=DummyLocker())
     self.seed_pool = MockSeedPool()