🚧 This instance is under construction; expect occasional downtime. Runners available in /repos. Questions? Ask in #wikimedia-gitlab on libera.chat, or under GitLab on Phabricator.

Commit e3e84d40 authored by Jgiannelos's avatar Jgiannelos
Browse files

Implement a CLI command for the tilelist generation

parent e9243e48
# Simplified map tilelist
Given an input file with a list of line seperated tiles in `{zoom}/{x}/{y}` format, generate a distinct list of map tiles for all zoom levels up to `maxzoom`.
## Usage
```
usage: cli.py [-h] tilelist_path maxzoom
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.
positional arguments:
tilelist_path Path to the tilelist input file.
maxzoom The maxzoom of the generated tilelist.
optional arguments:
-h, --help show this help message and exit
```
## Context
This CLI tool is built as a way to generate a simplified tile list of distinct tiles based on the `imposm3` expired tile output. The reason behind is this is to deduplicate tiles and optimize tile pregeneration by avoiding generating the same tile multiple times.
## Dependencies
- Python >= 3.7
import argparse
from tileset import TileSet
if __name__ == "__main__":
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(
"maxzoom", help="The maxzoom of the generated tilelist.", type=int
)
args = parser.parse_args()
ts = TileSet(args.tilelist_path, args.maxzoom)
ts.read()
for tile in ts.tileset:
print(f"{tile.z}/{tile.x}/{tile.y}")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment