mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
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:
21
python/pmtiles/bin/pmtiles-show
Executable file
21
python/pmtiles/bin/pmtiles-show
Executable 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))
|
||||
Reference in New Issue
Block a user