Trying to recreate an application made in carto v3 in the new version of carto (v4); here is the one which was create using v3. Problem we are running into is that we can't seem to figure out how to create multiple layers in v4, there is no documentation on a similar method like .createLayer()
from v3.
Does anyone have some workable related v4 code I could look at?
function retrieveLayer(map, cartoLayerSource, layerSide) {
return new Promise(function(resolve, reject) {
cartodb.createLayer(map, cartoLayerSource)
.addTo(map)
.on('done',
function(layer) {
// console.log(layer);
layerSides[layerSide] = layer;
resolve("loaded")
})
.on('error', function(error) {
// console.log(error);
});
})
}
1 Answer 1
Here you have an example, using several layers, with carto.js v4: https://carto.com/developers/carto-js/examples/#example-add-more-layers.
Instead of createLayer
you build your layers using new carto.layer.Layer
-
Thanks for that. Could you take a look at another question I have found here ? @Víctor Velardecvricella_sbu– cvricella_sbu2019年10月16日 13:47:03 +00:00Commented Oct 16, 2019 at 13:47