Search code examples
deck.gl

How to filter data on deck.gl TripsLayer


Here is my TripsLayer, and I want to filter some data. I think I can do this with trips.setProps({ data: newData}), but is there any other way to do this? like setting opacity to 0? Thanks

 trips = new MapboxLayer({
                id: 'trips',
                type: TripsLayer,
                data: ro,
                getPath: d => { 
                    return d.path
                },
                getTimestamps: d => {
                    return d.timestamps
                },
                getColor: d => d.color,

                widthMinPixels: 3,
                rounded: true,
                trailLength: 10000,
                currentTime: globalTime,
                shadowEnabled: false
            })

Solution

  • You can filter the data before and pass the filtered data to the layer.

    new MapboxLayer({
       data: filterData,
       ...
    })