#!/usr/bin/env python import sys import pprint from pmtiles.reader import Reader, MmapSource if len(sys.argv) <= 1: print("Usage: pmtiles-show PMTILES_FILE") print("Usage: pmtiles-show PMTILES_FILE Z X Y") exit(1) with open(sys.argv[1], "r+b") as f: reader = Reader(MmapSource(f)) if len(sys.argv) == 2: pprint.pprint(reader.header()) pprint.pprint(reader.metadata()) else: z = int(sys.argv[2]) x = int(sys.argv[3]) y = int(sys.argv[4]) sys.stdout.buffer.write(reader.get(z, x, y))