Skip to content

Instantly share code, notes, and snippets.

@javisantana
Last active December 18, 2015 14:29
Show Gist options
  • Save javisantana/5797542 to your computer and use it in GitHub Desktop.
Save javisantana/5797542 to your computer and use it in GitHub Desktop.
cartodb.createLayer(map, 'viz.json').done(function(layer) {
map.addLayer(layer);
var countries = layer.getSubLayer(0);
countries.setSQL('select * from countries');
var places = layer.createSubLayer({
sql: "select * from populated_places",
cartocss: "#layer { marker-fill: red; }"
})
setTimeout(function() {
places.remove();
}, 10000);
});
// creating a map without viz.json
cartodb.createLayer(map, {
type: 'cartodb',
layers: [{
sql: '....',
cartocss: '....'
}]
}).done(function(layer) {
leaflet.addLayer(layer)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment