cli.py 853 Bytes
Newer Older
1
2
3
4
5
import argparse

from tileset import TileSet


6
def main():
7
8
9
10
11
12
13
14
15
    parser = argparse.ArgumentParser(
        description="Given a tile list as input, generate a distinct "
        "list of map tiles consisted of all the parent and children tiles "
        "recursively up to a zoom level."
    )
    parser.add_argument(
        "tilelist_path", help="Path to the tilelist input file.", type=str
    )
    parser.add_argument(
16
17
18
19
20
21
22
        "maxzoom", help="The maximum zoom level of the generated tilelist.", type=int
    )
    parser.add_argument(
        "minzoom",
        default=0,
        help="The minimum zoom level of the generated tilelist.",
        type=int,
23
24
25
    )
    args = parser.parse_args()

26
    ts = TileSet(args.tilelist_path, args.minzoom, args.maxzoom)
27
28
29
30
    ts.read()

    for tile in ts.tileset:
        print(f"{tile.z}/{tile.x}/{tile.y}")