__init__.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:go2mapillary 作者: enricofer 项目源码 文件源码
def parent(ctx, input, depth):
    """Takes a [x, y, z] tile as input and writes its parent to stdout
    in the same form.

    $ echo "[486, 332, 10]" | mercantile parent

    Output:

    [243, 166, 9]
    """
    src = normalize_input(input)
    for line in iter_lines(src):
        tile = json.loads(line)[:3]
        if tile[2] - depth < 0:
            raise click.UsageError("Invalid parent level: {0}".format(tile[2] - depth))
        for i in range(depth):
            tile = mercantile.parent(tile)
        output = json.dumps(tile)
        click.echo(output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号