Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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){
        console.log(map.getLayers());
});

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.

Kind regards


EDIT

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 :)

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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 '13 at 15:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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