Cartodb.js Uncaught Error: sublayers are read-only in Named Maps

15 Views Asked by At

I am maintaining legacy code and I have the following error when trying to create and display a layer.

$('#zonasOSM').click(function(){
    scr="SELECT p.*, t.zona_osm FROM parcelas_1 p, table_0632030909 t where split_part(p.info_vl01, ';', 1)::int=NULLIF(t.part_prov,'')::int AND trim(p.info_vl01)!=''";
        
        
        if(fLayer){
            fLayer.remove();
        }
        var fLayerData={
            sql: scr,
            cartocss: '#layer{polygon-fill: #D6301D;polygon-opacity: 0.8;line-color: #000000;line-width: 1;line-opacity: 0.7}#layer[zona_osm="A"] {polygon-fill: #F0E68C;}#layer[zona_osm="B"] {   polygon-fill: #FFA500;}#layer[zona_osm="C"] {   polygon-fill: #229A00;} #layer[zona_osm="D"] {polygon-fill: #0000FF;} #layer[zona_osm="E"] {   polygon-fill: #A53ED5;}'
        };
        fLayer=cartodb_layers[1].createSubLayer(fLayerData); //<-- Problem Line
        $('#leyendasCat').show();
        $('#leyendasCod').hide();
    });

the error is shown on the console:

Uncaught Error: sublayers are read-only in Named Maps

I don't know if there is a configuration so that the sublayers are writable. Thank.

0

There are 0 best solutions below