Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(56)  |  Call(56)  |  Derive(0)  |  Import(0)
Returns the level index that offers the required resolution.

:param res: the required resolution
:returns: the level with the requested or higher resolution

>>> grid = TileGrid(SRS(900913))
>>> grid.stretch_factor = 1.1
>>> l1_res = grid.resolution(1)
>>> [grid.closest_level(x) for x in (320000.0, 160000.0, l1_res+50, l1_res,                                              l1_res-50, l1_res*0.91, l1_res*0.89, 8000.0)]
[0, 0, 1, 1, 1, 1, 2, 5]

src/m/a/mapproxy-HEAD/mapproxy/test/unit/test_grid.py   mapproxy(Download)
        eq_(grid.resolution(2), 0.01)
 
        eq_(grid.closest_level(0.00001), 2)
 
    def test_factor_grid(self):
    def test_lower_bound(self):
        # thresholds near the next lower res value
        grid = TileGrid(res=[1000, 500, 250, 100, 50], threshold_res=[300, 110])
        grid.stretch_factor = 1.1
        eq_(grid.closest_level(1100), 0)
        # regular transition (w/stretchfactor)
        eq_(grid.closest_level(950), 0)
        eq_(grid.closest_level(800), 1)
        eq_(grid.closest_level(500), 1)

src/m/a/MapProxy-1.6.0/mapproxy/test/unit/test_grid.py   MapProxy(Download)
        eq_(grid.resolution(2), 0.01)
 
        eq_(grid.closest_level(0.00001), 2)
 
    def test_factor_grid(self):
    def test_lower_bound(self):
        # thresholds near the next lower res value
        grid = TileGrid(res=[1000, 500, 250, 100, 50], threshold_res=[300, 110])
        grid.stretch_factor = 1.1
        eq_(grid.closest_level(1100), 0)
        # regular transition (w/stretchfactor)
        eq_(grid.closest_level(950), 0)
        eq_(grid.closest_level(800), 1)
        eq_(grid.closest_level(500), 1)