Is there a good way to change leaflet basemaps from cartodb.js or leaflet.js? I am able to grab the map object and basemap layer from the layers property in the done() promise.
cartodb.createVis(map, layerUrl, mapOptions)
.done(function(vis, layers) {
var map = vis.getNativeMap();
var basemap = layers[0];
})
.error(function(err) {
console.log("An error occurred: " + err);
});
Right now I'm thinking I need to be able to grab tileLayer from the basemap object or the map object, then use leaflet's setUrl
method as per http://leafletjs.com/reference.html#tilelayer-seturl, but so far no luck there.