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,