pmtiles-convert --gzip flag explicitly controls tile-level compression (default disabled) [#26]

This commit is contained in:
Brandon Liu
2022-01-23 13:44:50 +08:00
parent 7eea0bb8a3
commit d7ece9915b
3 changed files with 27 additions and 14 deletions

View File

@@ -21,10 +21,6 @@ class Writer:
self.leaves = []
def write_tile(self,z,x,y,data):
# if the tile is GZIP-encoded, it won't work with range queries
# until transfer-encoding: gzip is well supported.
if data[0:2] == b'\x1f\x8b':
data = gzip.decompress(data)
hsh = hash(data)
if hsh in self.hash_to_offset:
self.tiles.append((z,x,y,self.hash_to_offset[hsh],len(data)))