From 7f741def2d88d492a354e9a5238b1e345210a916 Mon Sep 17 00:00:00 2001 From: Jaak Date: Wed, 20 Dec 2017 09:18:36 +0200 Subject: [PATCH] #95 --- mb-util | 5 +++++ mbutil/util.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/mb-util b/mb-util index 7854264..9a90f5a 100755 --- a/mb-util +++ b/mb-util @@ -53,6 +53,11 @@ if __name__ == '__main__': action="store_true", default=False) + parser.add_option('--gzip', dest='gzip', + help='''Do gzip compression for all tiles (makes sense for pbf)''', + action="store_true", + default=False) + parser.add_option('--silent', dest='silent', help='''Dictate whether the operations should run silently''', action="store_true", diff --git a/mbutil/util.py b/mbutil/util.py index 50f581c..c9d5f62 100755 --- a/mbutil/util.py +++ b/mbutil/util.py @@ -239,6 +239,10 @@ def disk_to_mbtiles(directory_path, mbtiles_file, **kwargs): y = int(file_name) if (ext == image_format): + + if kwargs.get('gzip', False): + file_content = zlib.compress(file_content) + if not silent: logger.debug(' Read tile from Zoom (z): %i\tCol (x): %i\tRow (y): %i' % (z, x, y)) cur.execute("""insert into tiles (zoom_level,