Update recache script description
This commit is contained in:
parent
24a0861589
commit
1755f6344a
@ -7,6 +7,7 @@
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
@ -21,7 +22,7 @@ def clear_cache(cache_dir: Path, tile: str):
|
||||
print(f"Warning: cached tile {tile} did not exist", file=sys.stderr)
|
||||
|
||||
def recreate_tile(hostname: str, port: int, tile: str):
|
||||
tile_url = f'{hostname}/tiles/{tile}'
|
||||
tile_url = f'{hostname}:{port}/tiles/{tile}'
|
||||
req = requests.get(tile_url)
|
||||
if req.status_code != 200:
|
||||
raise Exception(f"Tile request for tile {tile} returned status {req.status_code} (data: {req.json()})")
|
||||
@ -44,24 +45,24 @@ def main(cache_dir: Path, tile_list: Path, hostname: str, port: int):
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
parser = argparse.ArgumentParser(
|
||||
parser = argparse.ArgumentParser(description=
|
||||
'''
|
||||
Re-cache map tiles listed in a file.
|
||||
Re-cache map tiles listed in a file.
|
||||
|
||||
Each line of the file should be of the format:
|
||||
[tileset]/[zoom]/[z]/[x]/[y][scale?].png
|
||||
E.g.
|
||||
date_year/16/32812/21775.png
|
||||
date_year/16/32810/21811@2x.png
|
||||
etc
|
||||
Each line of the file should be of the format:
|
||||
[tileset]/[zoom]/[z]/[x]/[y][scale?].png
|
||||
E.g.
|
||||
date_year/16/32812/21775.png
|
||||
date_year/16/32810/21811@2x.png
|
||||
etc
|
||||
|
||||
The order of lines in the file determines the order of re-caching.
|
||||
Names of re-cached tiles are printed to standard output.
|
||||
''')
|
||||
The order of lines in the file determines the order of re-caching.
|
||||
Names of re-cached tiles are printed to standard output.
|
||||
''', formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
|
||||
parser.add_argument('cache_directory', type=Path, help='The root directory of the tile cache (needs to be local)')
|
||||
parser.add_argument('tile_list', type=Path, help='Path to the list of tiles that should be re-cached.')
|
||||
parser.add_argument('--hostname', type=str, default="127.0.0.1", help='The hostname of the tile server')
|
||||
parser.add_argument('--hostname', type=str, default="http://127.0.0.1", help='The hostname of the tile server')
|
||||
parser.add_argument('--port', type=int, default=3000, help='The port numbre of the tile server')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
Loading…
Reference in New Issue
Block a user