• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python grid.tile_grid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mapproxy.grid.tile_grid函数的典型用法代码示例。如果您正苦于以下问题:Python tile_grid函数的具体用法?Python tile_grid怎么用?Python tile_grid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tile_grid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_non_matching_bboxfor_origins

    def test_non_matching_bboxfor_origins(self):
        g1 = tile_grid(SRS(21781), bbox=[420000, 30000, 900000, 360000],
            res=[250], origin='nw')
        g2 = tile_grid(SRS(21781), bbox=[420000, 30000, 900000, 360000],
            res=[250], origin='sw')

        assert not g1.is_subset_of(g2)
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:7,代码来源:test_grid.py


示例2: test_basic_mixed_name

    def test_basic_mixed_name(self):
        grid = tile_grid(4326, bbox=(-180, -90, 180, 90), origin='ll')
        assert grid.supports_access_with_origin('sw')
        assert not grid.supports_access_with_origin('nw')

        grid = tile_grid(4326, bbox=(-180, -90, 180, 90), origin='ul')
        assert not grid.supports_access_with_origin('sw')
        assert grid.supports_access_with_origin('nw')
开发者ID:deleted,项目名称:mapproxy,代码行数:8,代码来源:test_grid.py


示例3: test_epsg_4326_bbox_from_sqrt2

    def test_epsg_4326_bbox_from_sqrt2(self):
        base = tile_grid(srs='epsg:4326', res_factor='sqrt2')
        bbox = (10.0, -20.0, 40.0, 10.0)
        sub = tile_grid(align_with=base, bbox=bbox, res_factor=2.0)

        eq_(sub.bbox, bbox)
        eq_(sub.resolution(0), base.resolution(8))
        eq_(sub.resolution(1), base.resolution(10))
        eq_(sub.resolution(2), base.resolution(12))
开发者ID:deleted,项目名称:mapproxy,代码行数:9,代码来源:test_grid.py


示例4: test_custom_res_without_match

    def test_custom_res_without_match(self):
        grid = tile_grid(4326, bbox=(0, 0, 1024, 1023), origin='ll',
            res=[1, 0.5, 0.25])
        assert grid.supports_access_with_origin('ll')
        assert not grid.supports_access_with_origin('ul')

        grid = tile_grid(4326, bbox=(0, 0, 1024, 1023), origin='ul',
            res=[1, 0.5, 0.25])
        assert not grid.supports_access_with_origin('ll')
        assert grid.supports_access_with_origin('ul')
开发者ID:deleted,项目名称:mapproxy,代码行数:10,代码来源:test_grid.py


示例5: test_basic_no_level_zero

    def test_basic_no_level_zero(self):
        grid = tile_grid(4326, bbox=(-180, -90, 180, 90), origin='ll',
            min_res=360/256/2)
        assert grid.supports_access_with_origin('ll')
        assert grid.supports_access_with_origin('ul')

        grid = tile_grid(4326, bbox=(-180, -90, 180, 90), origin='ul',
            min_res=360/256/2)
        assert grid.supports_access_with_origin('ll')
        assert grid.supports_access_with_origin('ul')
开发者ID:deleted,项目名称:mapproxy,代码行数:10,代码来源:test_grid.py


示例6: test_custom_without_match

    def test_custom_without_match(self):
        # height is not divisible by res*tile_size
        grid = tile_grid(4326, bbox=(0, 0, 1024, 1000), origin='ll',
            min_res=1)
        assert grid.supports_access_with_origin('ll')
        assert not grid.supports_access_with_origin('ul')

        grid = tile_grid(4326, bbox=(0, 0, 1024, 1000), origin='ul',
            min_res=1)
        assert not grid.supports_access_with_origin('ll')
        assert grid.supports_access_with_origin('ul')
开发者ID:deleted,项目名称:mapproxy,代码行数:11,代码来源:test_grid.py


示例7: test_res_subset

    def test_res_subset(self):
        g1 = tile_grid(SRS(3857), res=[50000, 10000, 100, 1])
        g2 = tile_grid(SRS(3857), res=[100000, 50000, 10000, 1000, 100, 10, 1, 0.5])

        assert g1.tile_bbox((0, 0, 0)) != g2.tile_bbox((0, 0, 0))
        assert g1.is_subset_of(g2)

        g1 = tile_grid(SRS(3857), bbox=[0, 0, 20037508.342789244, 20037508.342789244],
            min_res=78271.51696402048, num_levels=18)
        g2 = tile_grid(SRS(3857), origin='nw')
        assert g1.is_subset_of(g2)
开发者ID:deleted,项目名称:mapproxy,代码行数:11,代码来源:test_grid.py


示例8: test_epsg_4326_bbox

    def test_epsg_4326_bbox(self):
        base = tile_grid(srs='epsg:4326')
        bbox = (10.0, -20.0, 40.0, 10.0)
        sub = tile_grid(align_with=base, bbox=bbox)

        eq_(sub.bbox, bbox)
        eq_(sub.resolution(0), 180/256/8)
        abbox, grid_size, tiles = sub.get_affected_level_tiles(bbox, 0)
        eq_(abbox, (10.0, -20.0, 55.0, 25.0))
        eq_(grid_size, (2, 2))
        eq_(list(tiles), [(0, 1, 0), (1, 1, 0), (0, 0, 0), (1, 0, 0)])
开发者ID:deleted,项目名称:mapproxy,代码行数:11,代码来源:test_grid.py


示例9: test_epsg_4326_bbox_to_sqrt2

    def test_epsg_4326_bbox_to_sqrt2(self):
        base = tile_grid(srs='epsg:4326', res_factor=2.0)
        bbox = (10.0, -20.0, 40.0, 10.0)
        sub = tile_grid(align_with=base, bbox=bbox, res_factor='sqrt2')

        eq_(sub.bbox, bbox)
        eq_(sub.resolution(0), base.resolution(4))
        eq_(sub.resolution(2), base.resolution(5))
        eq_(sub.resolution(4), base.resolution(6))

        assert sub.resolution(0) > sub.resolution(1) > sub.resolution(3)
        eq_(sub.resolution(3)/2, sub.resolution(5))
开发者ID:deleted,项目名称:mapproxy,代码行数:12,代码来源:test_grid.py


示例10: test_fixed_values

    def test_fixed_values(self):
        template = CouchDBMDTemplate({'hello': 'world', 'foo': 123})
        doc = template.doc(Tile((0, 0, 1)), tile_grid(4326))

        assert_almost_equal(doc['timestamp'], time.time(), 2)
        eq_(doc['hello'], 'world')
        eq_(doc['foo'], 123)
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:7,代码来源:test_cache_couchdb.py


示例11: load_expire_tiles

def load_expire_tiles(expire_dir, grid=None):
    if grid is None:
        grid = tile_grid(3857, origin='nw')
    tiles = set()

    def parse(filename):
        with open(filename) as f:
            try:
                for line in f:
                    if not line:
                        continue
                    tile = tuple(map(int, line.split('/')))
                    tiles.add(tile)
            except:
                log_config.warn('found error in %s, skipping rest of file', filename)

    if os.path.isdir(expire_dir):
        for root, dirs, files in os.walk(expire_dir):
            for name in files:
                filename = os.path.join(root, name)
                parse(filename)
    else:
        parse(expire_dir)

    boxes = []
    for tile in tiles:
        z, x, y = tile
        boxes.append(shapely.geometry.box(*grid.tile_bbox((x, y, z))))

    return boxes
开发者ID:LKajan,项目名称:mapproxy,代码行数:30,代码来源:geom.py


示例12: setup

 def setup(self):
     TileCacheTestBase.setup(self)
     self.cache = GeopackageLevelCache(
         self.cache_dir,
         tile_grid=tile_grid(3857, name='global-webmarcator'),
         table_name='test_tiles',
     )
开发者ID:LKajan,项目名称:mapproxy,代码行数:7,代码来源:test_cache_geopackage.py


示例13: test_bbox

 def test_bbox(self):
     grid = tile_grid(4326)
     template = TileURLTemplate(TESTSERVER_URL + '/service?BBOX=%(bbox)s')
     client = TileClient(template, grid=grid)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/service?BBOX=-180.00000000,0.00000000,-90.00000000,90.00000000'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((0, 1, 2)).source.read()
         eq_(resp, b'tile')
开发者ID:Geodan,项目名称:mapproxy,代码行数:9,代码来源:test_client.py


示例14: render

    def render(self, query):
        mapfile = self.mapfile
        if '%(webmercator_level)' in mapfile:
            _bbox, level = tile_grid(3857).get_affected_bbox_and_level(
                query.bbox, query.size, req_srs=query.srs)
            mapfile = mapfile % {'webmercator_level': level}

        if self.lock:
            with self.lock():
                return self.render_mapfile(mapfile, query)
        else:
            return self.render_mapfile(mapfile, query)
开发者ID:LKajan,项目名称:mapproxy,代码行数:12,代码来源:mapnik.py


示例15: setup

    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        riak_url = os.environ[self.riak_url_env]
        db_name = "mapproxy_test_%d" % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache(
            riak_url, db_name, "riak", tile_grid=tile_grid(3857, name="global-webmarcator"), lock_dir=self.cache_dir
        )
开发者ID:quiqua,项目名称:mapproxy,代码行数:12,代码来源:test_cache_riak.py


示例16: merge_tiles

def merge_tiles(couchdb, destination, level, bbox, matrix_set='GoogleMapsCompatible', origin='nw', overlay=False, format='GTiff', srs='EPSG:3857', gdal_translate_bin='/usr/bin/gdal_translate', gdalwarp_bin='/usr/bin/gdalwarp'):
    grid = tile_grid(3857, origin=origin, name=matrix_set)
    res = grid.resolution(level)
    ll_ur, xy_res, tiles = grid.get_affected_level_tiles(bbox, level)
    width = int(abs(bbox_width(bbox)) / res) or 1
    height = int(abs(bbox_height(bbox)) / res) or 1

    mode = 'RGBA' if overlay else 'RGB'

    _merge_tiles(
        load_tiles_from_couchdb(couchdb, tiles, grid, matrix_set),
        bbox, (width, height), res, mode=mode, t_format=format, t_name=destination, t_srs=srs,
        gdal_translate_bin=gdal_translate_bin, gdalwarp_bin=gdalwarp_bin)
开发者ID:GeoDodo,项目名称:gbi-client,代码行数:13,代码来源:tilemerge.py


示例17: setup

    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)
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:14,代码来源:test_cache_couchdb.py


示例18: test_template_values

    def test_template_values(self):
        template = CouchDBMDTemplate({'row': '{{y}}', 'tile_column': '{{x}}',
            'zoom': '{{level}}', 'time': '{{timestamp}}', 'coord': '{{wgs_tile_centroid}}',
            'datetime': '{{utc_iso}}', 'coord_webmerc': '{{tile_centroid}}'})
        doc = template.doc(Tile((1, 0, 2)), tile_grid(3857))

        assert_almost_equal(doc['time'], time.time(), 2)
        assert 'timestamp' not in doc
        eq_(doc['row'], 0)
        eq_(doc['tile_column'], 1)
        eq_(doc['zoom'], 2)
        assert_almost_equal(doc['coord'][0], -45.0)
        assert_almost_equal(doc['coord'][1], -79.17133464081945)
        assert_almost_equal(doc['coord_webmerc'][0], -5009377.085697311)
        assert_almost_equal(doc['coord_webmerc'][1], -15028131.257091932)
        assert re.match('20\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ', doc['datetime']), doc['datetime']
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:16,代码来源:test_cache_couchdb.py


示例19: estimate_project_tiles

def estimate_project_tiles(coverage, wmts_source, levels):
    if wmts_source.download_coverage:
        wmts_source_coverage = coverage_from_geojson(wmts_source.download_coverage)
    else:
        wmts_source_coverage = make_coverage(
            shapely.geometry.Polygon([
                (-20037508.34, -20037508.34),
                (-20037508.34, 20037508.34),
                (20037508.34, 20037508.34),
                (20037508.34, -20037508.34)
            ]), SRS(3857))
    coverage_intersection = wmts_source_coverage.geom.intersection(coverage.geom)
    if not coverage_intersection:
        return 0
    intersection = make_coverage(coverage_intersection, SRS(3857))

    tiles = estimate_tiles(tile_grid(3857), levels, intersection)
    return tiles
开发者ID:omniscale,项目名称:gbi-client,代码行数:18,代码来源:project.py


示例20: test_minimal_tiles_fragmented_ul

    def test_minimal_tiles_fragmented_ul(self):
        self.mgrid = MetaGrid(grid=tile_grid('EPSG:4326', origin='ul'),
            meta_size=(2, 2), meta_buffer=10)
        sgrid = self.mgrid.minimal_meta_tile(
            [
                           (2, 0, 3),
                (1, 1, 3),
                           (2, 2, 3),
            ])

        eq_(sgrid.grid_size, (2, 3))
        eq_(list(sgrid.tile_patterns),
            [
                ((1, 0, 3), (10, 0)), ((2, 0, 3), (266, 0)),
                ((1, 1, 3), (10, 256)), ((2, 1, 3), (266, 256)),
                ((1, 2, 3), (10, 512)), ((2, 2, 3), (266, 512)),
            ]
        )
        eq_(sgrid.bbox, (-136.7578125, -46.7578125, -43.2421875, 90.0))
开发者ID:deleted,项目名称:mapproxy,代码行数:19,代码来源:test_grid.py



注:本文中的mapproxy.grid.tile_grid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python grid.MetaGrid类代码示例发布时间:2022-05-27
下一篇:
Python grid.bbox_contains函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap