Skip to content

Instantly share code, notes, and snippets.

@miketahani
Last active August 29, 2015 14:19
Show Gist options
  • Save miketahani/6d0ea617c2881d6df1a4 to your computer and use it in GitHub Desktop.
Save miketahani/6d0ea617c2881d6df1a4 to your computer and use it in GitHub Desktop.
grab mapbox studio tiles

apparently mapbox no longer lets you export mbtiles locally like tilemill used to. this can be a problem when you just spent an hour creating a tileset and suddenly realize that you need to fork over a monthly fee to get your tiles out.

this is the general structure of mapbox studio local tile urls (for styles): http://localhost:3000/style/<z>/<x>/<y>.<ext>?id=tmstyle://<file path>/<style name>.tm2&<autogenerated id>.

after selecting a project, View > Toggle Developer Tools, Network tab, copy the url for a tile, replace the part that corresponds to <z>/<x>/<y> above with {z}/{x}/{y} and you have a template url.

you can use the url to put together a custom provider in tilestache (have to do it yourself, since the proxy provider doesn't seem to support querystring arguments with urls) or if you're doing some rapid prototyping like i was, use this simple script to cache the tiles while you're working on other aspects of the map in the browser.

NOTE: you shouldn't use this to steal mapbox resources or tiles, but if you accidentally spent a bunch of time designing a map only to realize that mapbox studio !== tilemill 3, i figure you get a one-time pass to get your tiles out.

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