Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Delete zoom levels from an MBTiles file (set max zoom)
-- change 18 to whatever the max zoom level you want in your MBTiles
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 18) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 18);
DELETE FROM map WHERE zoom_level > 18;
UPDATE metadata SET value = '18' WHERE name = 'maxzoom';
-- now run the VACUUM command
Copy link

mabsplanner commented Mar 29, 2014

I'm badly in need to change max. zoom level of my *.mbtiles file. Can you please help how to use these codes. I'm completely new in GistBox. I'm not sure where and how to use these codes. Please help me. Any help will make me grateful to you.


Copy link

mapmeld commented Jun 13, 2015

I'm doing this on a raster MBtiles which doesn't have an "images" table. If you're in the same situation, replace the first two statements with this:

DELETE FROM tiles WHERE zoom_level > 18;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment