I have been given an mbtiles file which contains tiles for zoom levels between 16 and 20. When I preview the mbtiles on tilestache, I am not able to zoom in beyond the 18th level. If I request the map at zoom level 19, tiles of zoom level 18 are being rendered. I have viewed the mbtiles files and sure enough there is text "minzoom16" and "maxzoom20".

There is another mbtiles file with tiles from zoom levels 11 to 16. It is rendering tiles requested for zoom level 18 too; beyond zoom level that no tiles.

This makes me wonder if there is any internal setting in the tilestache code that limits the server to rendering tiles up to a certain zoom level. I have searched the source, but couldn't find anything in particular; not that I am a python programmer, but still.

If tilestache limits the zoom levels to a certain number, how can that be changed?

   "provider": {"name": "mbtiles", "tileset": "/home/***/****/tiles/bholakpur.mbtiles"},
   "preview": {"zoom": 20, "ext": "png"}

Bing layer is the base layer for the map and as far as my tests go Bing has only 18 zoom levels. Maybe that is the reason the other layers are not requesting tiles beyond the 18th zoom level.


1 Answer 1


Srisa, I know it's been many months since you asked this question, but I've just had to grapple with the same issue. Turns out that the zoom limit of 18 is in modestmaps.js, not TileStache, and you can get around it by adding a call to .setZoomRange() in TileStache/Core.py. Here are lines 729-746:

    <div id="map"></div>
    <script type="text/javascript" defer>
        var template = '{Z}/{X}/{Y}.%(ext)s';
        var provider = new com.modestmaps.TemplatedMapProvider(template);
        var map = new MM.Map('map', provider, null, [
            new MM.TouchHandler(),
            new MM.DragHandler(),
            new MM.DoubleClickHandler()
        map.setZoomRange(0, 22);
        map.setCenterZoom(new com.modestmaps.Location(%(lat).6f, %(lon).6f), %(zoom)d);
        // hashify it
        new MM.Hash(map);

I didn't want to deal with it again, so I set the range to the maximum.

I have to thank Dane Springmeyer of MapBox for aiming me in the right direction.

  • Thank you for the heads up, will check it out when I have enough time.
    – Srisa
    Oct 3, 2013 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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