当前位置: 首页>>代码示例>>Python>>正文


Python BoundingPyramid.full方法代码示例

本文整理汇总了Python中tilecloud.BoundingPyramid.full方法的典型用法代码示例。如果您正苦于以下问题:Python BoundingPyramid.full方法的具体用法?Python BoundingPyramid.full怎么用?Python BoundingPyramid.full使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tilecloud.BoundingPyramid的用法示例。


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

示例1: test_full

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import full [as 别名]
 def test_full(self):
     bp = BoundingPyramid.full(1, 3)
     self.assertRaises(KeyError, bp.zget, 0)
     self.assertEqual(bp.zget(1), (Bounds(0, 2), Bounds(0, 2)))
     self.assertEqual(bp.zget(2), (Bounds(0, 4), Bounds(0, 4)))
     self.assertEqual(bp.zget(3), (Bounds(0, 8), Bounds(0, 8)))
     self.assertRaises(KeyError, bp.zget, 4)
开发者ID:gijs,项目名称:tilecloud,代码行数:9,代码来源:test_boundingpyramid.py

示例2: __init__

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import full [as 别名]
 def __init__(self, tile_json, urls_key='tiles', **kwargs):
     # FIXME schema
     # FIXME version 1.0.0 support
     d = json.loads(tile_json)
     assert 'tiles' in d
     assert isinstance(d['tiles'], list)
     assert len(d['tiles']) > 0
     for key in self.KEYS:
         kwargs.setdefault(key, d.get(key, None))
     if 'bounding_pyramid' not in kwargs:
         zmin, zmax = d.get('minzoom', 0), d.get('maxzoom', 22)
         if 'bounds' in d:
             lonmin, latmin, lonmax, latmax = d['bounds']
             bounding_pyramid = BoundingPyramid.from_wgs84(zmin, zmax,
                                                           lonmin, lonmax,
                                                           latmin, latmax)
         else:
             bounding_pyramid = BoundingPyramid.full(zmin, zmax)
         kwargs['bounding_pyramid'] = bounding_pyramid
     urls = d[urls_key]
     if 'content_type' not in kwargs:
         exts = set(os.path.splitext(urlparse(url).path)[1] for url in urls)
         content_types = set(mimetypes.types_map.get(ext) for ext in exts)
         assert len(content_types) == 1
         kwargs['content_type'] = content_types.pop()
     templates = [re.sub(r'\{([xyz])\}', lambda m: '%%(%s)d' % m.group(1), url)
                  for url in urls]
     tile_layouts = map(TemplateTileLayout, templates)
     URLTileStore.__init__(self, tile_layouts, **kwargs)
开发者ID:fredj,项目名称:tilecloud,代码行数:31,代码来源:tilejson.py

示例3: test_metatilecoords

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import full [as 别名]
 def test_metatilecoords(self):
     bp = BoundingPyramid.full(1, 2)
     metatilecoords = bp.metatilecoords(2)
     self.assertEqual(TileCoord(1, 0, 0, 2), next(metatilecoords))
     self.assertEqual(TileCoord(2, 0, 0, 2), next(metatilecoords))
     self.assertEqual(TileCoord(2, 0, 2, 2), next(metatilecoords))
     self.assertEqual(TileCoord(2, 2, 0, 2), next(metatilecoords))
     self.assertEqual(TileCoord(2, 2, 2, 2), next(metatilecoords))
     self.assertRaises(StopIteration, next, metatilecoords)
开发者ID:gijs,项目名称:tilecloud,代码行数:11,代码来源:test_boundingpyramid.py


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