How to use the mercantile.children function in mercantile

To help you get started, we’ve selected a few mercantile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapbox / mercantile / tests / test_funcs.py View on Github external
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)
github lukasmartinelli / mbtoolbox / mbtoolbox / optimize.py View on Github external
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
github lukasmartinelli / mbtoolbox / mbtoolbox / verify.py View on Github external
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
github mojodna / marblecutter / examples / aws_s3_tile_cp.py View on Github external
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)
github mojodna / marblecutter / examples / render_pyramid.py View on Github external
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)
github mapbox / mercantile / mercantile / scripts / __init__.py View on Github external
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)
github osm2vectortiles / osm2vectortiles / tools / verify / verify.py View on Github external
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)