rio-pmtiles python package [#338] (#542)

Add rio-pmtiles command line tool. [#338]

This is derived from the original mapbox/rio-mbtiles implementation, with changes:

* output PMTiles only instead of MBTiles.
* Python 3.7+ only.
* remove --implementation, --image-dump, --append/--overwrite, --covers features.
* bump dependency versions.
* better progress reporting; add pyroaring. 
* update README and license texts.
* rio-pmtiles v0.0.6 on PyPI
This commit is contained in:
Brandon Liu
2025-03-24 20:50:53 +08:00
committed by GitHub
parent 1d897f4f7e
commit 63182e525d
36 changed files with 1296 additions and 2 deletions

21
python/pmtiles/bin/pmtiles-show Executable file
View File

@@ -0,0 +1,21 @@
#!/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))