本文整理汇总了Python中tilecloud.BoundingPyramid.add方法的典型用法代码示例。如果您正苦于以下问题:Python BoundingPyramid.add方法的具体用法?Python BoundingPyramid.add怎么用?Python BoundingPyramid.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tilecloud.BoundingPyramid
的用法示例。
在下文中一共展示了BoundingPyramid.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_add(self):
bp = BoundingPyramid()
bp.add(TileCoord(1, 0, 0))
self.assertEqual(len(bp), 1)
self.assertTrue(TileCoord(1, 0, 0) in bp)
self.assertFalse(TileCoord(1, 0, 1) in bp)
self.assertFalse(TileCoord(1, 1, 0) in bp)
self.assertFalse(TileCoord(1, 1, 1) in bp)
self.assertEqual(list(bp), [TileCoord(1, 0, 0)])
示例2: test_zs
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_zs(self):
bp = BoundingPyramid()
bp.add(TileCoord(2, 1, 3))
bp.fillup(0)
self.assertEqual(sorted(bp.zs()), [0, 1, 2])
示例3: test_ziter
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_ziter(self):
bp = BoundingPyramid()
bp.add(TileCoord(2, 1, 3))
bp.fillup(0)
self.assertEqual(list(bp.ziter(1)), [TileCoord(1, 0, 1)])
示例4: test_itertopdown
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_itertopdown(self):
bp = BoundingPyramid()
bp.add(TileCoord(2, 1, 3))
bp.fillup(0)
self.assertEqual(list(bp.itertopdown()), [TileCoord(0, 0, 0), TileCoord(1, 0, 1), TileCoord(2, 1, 3)])
示例5: test_fillup
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_fillup(self):
bp = BoundingPyramid()
bp.add(TileCoord(2, 1, 3))
bp.fillup(0)
self.assertEqual(bp.zget(1), (Bounds(0, 1), Bounds(1, 2)))
self.assertEqual(bp.zget(0), (Bounds(0, 1), Bounds(0, 1)))
示例6: test_filldown
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_filldown(self):
bp = BoundingPyramid()
bp.add(TileCoord(1, 1, 0))
bp.filldown(3)
self.assertEqual(bp.zget(2), (Bounds(2, 4), Bounds(0, 2)))
self.assertEqual(bp.zget(3), (Bounds(4, 8), Bounds(0, 4)))
示例7: test_iterbottomup
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def test_iterbottomup(self):
bp = BoundingPyramid()
bp.add(TileCoord(2, 1, 3))
bp.fill_up(0)
self.assertEqual(list(bp.iterbottomup()), [TileCoord(2, 1, 3), TileCoord(1, 0, 1), TileCoord(0, 0, 0)])
示例8: init_tilecoords
# 需要导入模块: from tilecloud import BoundingPyramid [as 别名]
# 或者: from tilecloud.BoundingPyramid import add [as 别名]
def init_tilecoords(self, layer):
resolutions = layer['grid_ref']['resolutions']
if self.options.time is not None and self.options.zoom is None:
if 'min_resolution_seed' in layer: # pragma: no cover
self.options.zoom = [resolutions.index(
layer['min_resolution_seed']
)]
else:
self.options.zoom = [len(resolutions) - 1]
if self.options.zoom is not None:
zoom_max = len(resolutions) - 1
for zoom in self.options.zoom:
if zoom > zoom_max:
logger.warning(
"zoom %i is greater than the maximum zoom %i"
" of grid %s of layer %s, ignored." % (
zoom, zoom_max, layer['grid'], layer['name']
)
)
self.options.zoom = [z for z in self.options.zoom if z <= zoom_max]
if 'min_resolution_seed' in layer:
if self.options.zoom is None:
self.options.zoom = []
for z, resolution in enumerate(resolutions):
if resolution >= layer['min_resolution_seed']:
self.options.zoom.append(z)
else:
for zoom in self.options.zoom:
resolution = resolutions[zoom]
if resolution < layer['min_resolution_seed']:
logger.warning(
"zoom %i corresponds to resolution %s is smaller"
" than the 'min_resolution_seed' %s of layer %s, ignored." %
(
zoom, resolution, layer['min_resolution_seed'], layer['name']
)
)
self.options.zoom = [
z for z in self.options.zoom if
resolutions[z] >= layer['min_resolution_seed']
]
if self.options.zoom is None:
self.options.zoom = [z for z, r in enumerate(resolutions)]
# fill the bounding pyramid
tilegrid = layer['grid_ref']['obj']
bounding_pyramid = BoundingPyramid(tilegrid=tilegrid)
for zoom in self.options.zoom:
if zoom in self.geoms:
extent = self.geoms[zoom].bounds
if len(extent) == 0:
logger.warning("bounds empty for zoom {}".format(zoom))
else:
minx, miny, maxx, maxy = extent
px_buffer = layer['px_buffer']
m_buffer = px_buffer * resolutions[zoom]
minx -= m_buffer
miny -= m_buffer
maxx += m_buffer
maxy += m_buffer
bounding_pyramid.add(tilegrid.tilecoord(
zoom,
max(minx, tilegrid.max_extent[0]),
max(miny, tilegrid.max_extent[1]),
))
bounding_pyramid.add(tilegrid.tilecoord(
zoom,
min(maxx, tilegrid.max_extent[2]),
min(maxy, tilegrid.max_extent[3]),
))
if layer.get('meta', False):
self.set_tilecoords(bounding_pyramid.metatilecoords(layer['meta_size']), layer)
else:
self.set_tilecoords(bounding_pyramid, layer)