Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_child_bad_tile_zoom():
with pytest.raises(mercantile.InvalidZoomError) as e:
mercantile.children((243, 166, 9), zoom=8)
assert "zoom must be an integer and greater than" in str(e.value)
def all_descendant_tiles(x, y, zoom, max_zoom):
"""Return all subtiles contained within a tile"""
if zoom < max_zoom:
for child_tile in mercantile.children(x, y, zoom):
yield child_tile
for desc_tile in all_descendant_tiles(child_tile.x, child_tile.y,
child_tile.z, max_zoom):
yield desc_tile
def all_descendant_tiles(x, y, zoom, max_zoom):
"""Return all subtiles contained within a tile"""
if zoom < max_zoom:
for child_tile in mercantile.children(x, y, zoom):
yield child_tile
for desc_tile in all_descendant_tiles(child_tile.x, child_tile.y,
child_tile.z, max_zoom):
yield desc_tile
def queue_tile(tile, max_zoom, remove_hash, from_s3, to_s3):
queue_render(tile, remove_hash, from_s3, to_s3)
if tile.z < max_zoom:
for child in mercantile.children(tile):
queue_tile(child, max_zoom, remove_hash, from_s3, to_s3)
def queue_tile(tile, s3_details, sources):
queue_render(tile, s3_details, sources)
if tile.z < MAX_ZOOM:
for child in mercantile.children(tile):
queue_tile(child, s3_details, sources)
a pretty-printed ASCII RS-delimited sequence of JSON (like
https://tools.ietf.org/html/rfc8142 and
https://tools.ietf.org/html/rfc7159).
$ echo "[486, 332, 10]" | mercantile parent
Output:
[243, 166, 9]
"""
src = normalize_input(input)
for line in iter_lines(src):
line = line.strip()
tiles = [json.loads(line)[:3]]
for i in range(depth):
tiles = sum([mercantile.children(t) for t in tiles], [])
for t in tiles:
output = json.dumps(t)
click.echo(output)
def all_descendant_tiles(x, y, zoom, max_zoom):
"""Return all subtiles contained within a tile"""
if zoom < max_zoom:
for child_tile in mercantile.children(x, y, zoom):
yield child_tile
yield from all_descendant_tiles(child_tile.x, child_tile.y,
child_tile.z, max_zoom)