This is my first time using MapBox and I'm trying to import a map from TileMill.

The map has 11 layers, in TileMill, but when I import it directly to MapBox, it only seems to have a single layer.

It still shows all of the layers, but if I run the following, it returns a single layer, which seems to have all of the data on:

mapbox.auto('map', 'MAP_NAME', function(map){

For the map functionality, I need to be able to switch the layers on/off via user interaction, so having everything in a single layer is a slight issue.

Am I doing something wrong? I really hope that I don't have to export each of my TileMill layers individually, as this will take so much time..

Any help/advice would be much appreciated.


After hours of searching, I've found this question on the MapBox support pages: http://support.mapbox.com/discussions/tilemill/2122-creating-a-batch-of-layers

It looks like TileMill is unable to export the layers and keep them as separate layers. Instead I will probably have to export each layer individually, which is a bit of a pain, but oh well.

If anyone has any better suggestion, please let me know :)

  • Did you find any easy way of exporting the layers one at a time or did you have to create a tilemill project for each layer you want.
    – Jona
    Feb 20, 2015 at 16:13

1 Answer 1


TileMill produces tiles according to the parameters you specify. If you wanted to be able to display different sets of layers with something produced through TileMill, you'd need to create different sets of tiles depending on the combinations of layers you wanted to allow the user to view, and use feedback from the browser to switch between those sets of tiles.

If you want to be able to "turn on/turn off" layers like in GIS software, you can look at some of the many webmapping options (OpenLayers, Leaflet, MapServer, GeoServer, etc etc). MapBox might well have a product that would let you do this too.

  • MapBox does allow the switching between layers. There's a script in their sample showing how to do so: mapbox.com/mapbox.js/example/layers The problem I'm having is that TileMill seems to compress all of my layers into one, during export. It looks like my only option is to export each layer as a separate map. I'm just updating my question with a link that I've found (after hours of searching).
    – GreenImp
    Jan 29, 2013 at 15:03

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.