Skip to content

Commit f994bbd

Browse files
committed
make sure pbf/mvt are gzipped
1 parent 1b0a8c6 commit f994bbd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mbutil/util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ def disk_to_pmtiles(directory_path, pmtiles_file, **kwargs):
780780
for tileid, file_path in tiles_to_process:
781781
with open(file_path, 'rb') as f:
782782
file_content = f.read()
783+
# Ensure PBF/MVT tiles are gzip-compressed to match header
784+
if image_format in ('pbf', 'mvt') and file_content[0:2] != b"\x1f\x8b":
785+
file_content = gzip.compress(file_content)
783786
writer.write_tile(tileid, file_content)
784787
stats['total_size'] += len(file_content)
785788

0 commit comments

Comments
 (0)