From 4ddda6649880c31195ccb44edfb0173398595e39 Mon Sep 17 00:00:00 2001 From: Ben Ayre Date: Wed, 13 Jul 2022 08:48:44 +0100 Subject: [PATCH] Adopt Reader, MmapSource in pmtiles_to_dir --- python/pmtiles/convert.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/pmtiles/convert.py b/python/pmtiles/convert.py index 877b0cb..c887589 100644 --- a/python/pmtiles/convert.py +++ b/python/pmtiles/convert.py @@ -85,8 +85,10 @@ def pmtiles_to_mbtiles(input, output, gzip): def pmtiles_to_dir(input, output, gzip): os.makedirs(output) - with read(input) as reader: - metadata = reader.metadata + with open(input, "r+b") as f: + source = MmapSource(f) + reader = Reader(source) + metadata = reader.header().metadata metadata = set_metadata_compression(metadata, gzip) with open(os.path.join(output, "metadata.json"), "w") as f: f.write(json.dumps(metadata))