1

I am unable to remove the legend from a CartoDB layer. I have passed legends: false in createLayer options but with no luck. Below the code i used :

cartodb.createLayer(map, BikeTrails)

                .on('done', function(layer) {legends:false

                layerBikeTrails = layer;

L.control.layers(null, {
    'Dedicated Bike Lanes': layerBikeLanes, 
    'Bike Share Toronto': layerBikeShare, 
    'Bike Stores': layerBikeStores, 
    'Access to Multipurpose Trails': layerBikeTrails
})
.addTo(map);

2 Answers 2

1

It looks like you are not passing the layer options in the right place.

This should work:

cartodb.createLayer(map, vizjson_url, { legends: false })
.addTo(map)
.done(function(layer) {
   /* ... */
};

For more information, have a look to the cartodb.js documentation.

0

Keep in mind that options is the third argument of createLayer:

var options = {
  legends: false
}

cartodb.createLayer(map, url, options).addTo(map);

Your Answer

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

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