0

I created a simple map with multiple layers using the below code.

this.cartoSource = new carto.source.SQL(sql);
this.layerStyle  = new carto.style.CartoCSS(layerStyle);
this.layer = new carto.layer.Layer(this.cartoSource, this.layerStyle , layerOption);

Whenever there is a change in the source or firing feature_cover event, all map layers are repainted (a kind of flickering). why does a layer affect another independent layer?

My requirements are I have a layer with polygon shape. Whenever a user hovers over a particular polygon, that feature should be highlighted without repainting or flickering.

I tried two different ways:

  1. I was updating layer style using setContent with the following code:
    #layer[cartodb_id=123]
            { 
                line-opacity: 1; 
                line-color: #FFF; 
                line-width: 1; 
                polygon-fill: #f4c650; 
            }
  1. I was using another layer with one sql source with where condition where cartodb_id = FEATURE_OVER.data.cartodb_id.

Both are getting a flickering effect. How can I solve this issue?

  • I got the solution. The problem was, I was reusing the carto client for all the layers. Thats the reason. It was affecting all of them. – user146810 Jul 26 at 6:15
  • Please @user146810 if you had the solution to your own question, you have to post it as an answer. – ramiroaznar Jul 29 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.