mbutil icon indicating copy to clipboard operation
mbutil copied to clipboard

Feature request: Set zoom level range?

Open bongobongo opened this issue 6 years ago • 4 comments

I would like to generate tiles only from zoom level 1 to 11 It would be very practical if it was possible to set two parameters for mbutil. Something like: zoom_level_start=1 zoom_level_en=11

This would make it possible to significantly reduce the time to generate the tiles.

Any chance to see this feature implemented? If not, could somebody tell me what code changes that would have to be done to make it possible to set a zoom range.

bongobongo avatar Jul 15 '18 09:07 bongobongo

https://github.com/mapbox/mbutil/blob/2fc4161f9be890a65d07f5e7b2ed0c8a0a123ed6/mbutil/util.py#L312

This while loop pulls tiles one by one from the database. There may be a more efficient way, but you could just check the tile to see if it's in your zoom range and add a continue statement if it's not.

z = t[0]
if z < minZoom or z > maxZoom:
  continue

Wieschie avatar Jun 18 '19 15:06 Wieschie

I manually deleted the room range using this: https://gist.github.com/zhm/3830471

maxammann avatar Feb 11 '21 17:02 maxammann

sorry to bump up, someone found a solution to set the zoom level ? @maxammann where to apply, no found in util.py

AnthonyHervy avatar Jul 21 '22 15:07 AnthonyHervy

sorry to bump up, someone found a solution to set the zoom level ? @maxammann where to apply, no found in util.py

You can open a mbtiles files using sqlite3 on the command line. Then you cam enter the commands from the Github Gist. Make a backup first though.

maxammann avatar Jul 22 '22 14:07 maxammann