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


Python BoundingPyramid.from_string方法代码示例

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


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

示例1: main

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import from_string [as 别名]
def main(argv):
    # Create our input and output TileStores
    input_tilestore = TileStore.load('tiles.openstreetmap_org')
    output_tilestore = TileStore.load('local.mbtiles')
    # 1. Generate a list of tiles to download from a BoundingPyramid
    #    4/8/5 is the root tile, corresponding to Central Europe
    #    +3/+1/+1 specifies up to zoom level 4 + 3 = 7 and an extent of one tile in the X and Y directions
    bounding_pyramid = BoundingPyramid.from_string('4/8/5:+3/+1/+1')
    bounding_pyramid_tilestore = BoundingPyramidTileStore(bounding_pyramid)
    tilestream = bounding_pyramid_tilestore.list()
    # 2. Filter out tiles that already downloaded
    tilestream = (tile for tile in tilestream if not tile in output_tilestore)
    # 3. Get the tile from openstreetmap.org
    tilestream = input_tilestore.get(tilestream)
    # 4. Save the tile to local.mbtiles
    tilestream = output_tilestore.put(tilestream)
    # 5. Log the fact that the tile was downloaded
    tilestream = imap(Logger(logger, logging.INFO, 'downloaded %(tilecoord)s'), tilestream)
    # Go!
    consume(tilestream, None)
开发者ID:Web5design,项目名称:tilecloud,代码行数:22,代码来源:download.py

示例2: test_init_boundingpyramid

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import from_string [as 别名]
 def test_init_boundingpyramid(self):
     ts = TileStore(bounding_pyramid=BoundingPyramid.from_string('1/0/0:1/1'))
     self.assertTrue(Tile(TileCoord(1, 0, 0)) in ts)
     tiles = list(ts.list())
     self.assertEqual(len(tiles), 1)
     self.assertEqual(tiles[0].tilecoord, TileCoord(1, 0, 0))
开发者ID:gijs,项目名称:tilecloud,代码行数:8,代码来源:test_tilestore.py

示例3: test_from_string_up

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

示例4: test_from_string_one_level

# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import from_string [as 别名]
 def test_from_string_one_level(self):
     bp = BoundingPyramid.from_string('5/9/13:12/15')
     self.assertRaises(KeyError, bp.zget, 4)
     self.assertEqual(bp.zget(5), (Bounds(9, 12), Bounds(13, 15)))
     self.assertRaises(KeyError, bp.zget, 6)
开发者ID:gijs,项目名称:tilecloud,代码行数:7,代码来源:test_boundingpyramid.py

示例5: test_from_string_relative

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

示例6: test_from_string_star

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


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