0

I've used mbutil successfully to unpack a .mbtiles file, but if I try to repack the same tiles, something goes wrong. I'm using the util module in a python script like so:

from mbutil import util

mbtiles = r"c:\a\tiles.mbtiles"
mbtiles2 = r"c:\a\mod_tiles.mbtiles"
tiledir = r"c:\a\tiles_temp"

util.mbtiles_to_disk(mbtiles,tiles_temp)
## do stuff to tiles
util.disk_to_mbtiles(tiles_temp,mbtiles2)

The resulting .mbtiles file is only 6kb and when I unpack that file, only the metadata.json file is present.

I installed the mbutil package using easy_install.

1

Well, it seemed like the problem was just with the python bindings. I modified my script to feed the commands into the command line like so:

#util.disk_to_mbtiles(out_dir, out_mbt)
os.system("python {0} {1} {2}".format(path_to_mbutil,out_dir,out_mbt))

Now it works fine.

UPDATE: Actually, I'm finding that once an .mbtiles file has been unpacked and repacked with this method, even if no changes are made to the tiles or anything, the new .mbtiles file does not function correctly in GeoServer, which is where I'm trying to use it. So it seems like there is an issues with the repacking method in mb-util.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.