How to toggle layer visibilty in kepler.gl react.js?

479 Views Asked by At

I have added a layer in my React app with kepler.gl.

But the visibility of the layer is turned off. I can manually toggle the visibility in the map but not able to do so using React.

enter image description here

This is my config which I am passing in addDataToMap:

    visState: {
        layerBlending: "normal",
        layers: [{
            id: "hty62yd",
            type: "point",
            config: {
                dataId: "dataset1",
                label: "label1",
                color: [
                    192,
                    192,
                    23
                ],
                columns: {
                    lat: "lat",
                    lng: "lon"
                }
            },
            isVisible: true,
            radius: 80
        }]
    }
};

1

There are 1 best solutions below

0
On

The isVisible parameter was in wrong place.

Correct config is:

config: {
            dataId: "dataset1",
            label: "dataset1",
            color: [
                192,
                192,
                23
            ],
            columns: {
                lat: "lat",
                lng: "lon",
                altitude: ""
            },
            isVisible: true
        }