I'm trying to locally host / serve / cache a set of tiles for a very small geographic area in a mapbox js application I'm building. I've been searching for a way to do this, but most of the info I've come across seems to center around mbtiles - which it doesn't seem that mapbox studio gives you the ability to export any more. The only option I'm aware of is to download a package in the form of "tm2z".

How would I host this package locally? Or how would I export an mbtiles package?

I've seen this thread: Using Mapbox Studio (aka Tilemill 2) to create a self-hosted map

which was somewhat helpful in understanding the process, but I'm still lost as to how to get a data source one of these servers would understand.

I also found this:


but it only covers tm2 files. I've found zero information about handling the tm2z format.

1 Answer 1


The answer to your question is largely dependent on the nature of the data you'd like to export.

  • If you would like to turn your own data into vector tiles, you have a couple of options:
    1. Add your data as a source in Mapbox Studio Classic and click Save As. Then, in the Settings menu, click Export to MBTiles, wait for processing to complete, and click Download. The resulting .mbtiles file contains your vector tiles.
    2. Use Tippecanoe to create your own raster tiles from the command line.
  • If the data you would like to cache is from a Mapbox hosted map, this isn't possible. I posted the following in another thread:

[vector tile sources are] ... incompatible with Tilemill. Mapbox maps are rendered on the server from sources and styles, after which the resulting raster tiles are sent to your browser. This means that, unless you're uploading or replacing source data, you're never actually interacting with vector tile data stored on Mapbox's servers.

Aside from technical limitations, it is actually against Mapbox's Terms of Service to cache and redistribute hosted maps, which includes mapbox.mapbox-terrain-v2.

If you would like to use TileMill to generate your own raster mbtiles, you can try using raw OpenStreetMap data and an open source style, such as OSM Bright.

Regarding the tm2z format, it is used to package up your project files, not including source data, and upload them to Mapbox's servers. You can read more here - https://www.mapbox.com/guides/style-manual/#publish-styles.

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.