0

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);
 });
 })
 }
Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Oct 10, 2019 at 23:19

1 Answer 1

0

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

answered Oct 11, 2019 at 8:11
1
  • Thanks for that. Could you take a look at another question I have found here ? @Víctor Velarde Commented Oct 16, 2019 at 13:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.