kepler.gl icon indicating copy to clipboard operation
kepler.gl copied to clipboard

Add/Remove Layer Data

Open rameshbabuch opened this issue 6 years ago • 2 comments

Hi In this PR I have added two methods to add/remove data from layers which is usefull to add/remove dynamic data. The two methods added are

  • addLayerData
  • removeLayerData
addLayerData

This method is similar to addDataToMap and also takes dataset key column to update the layer data. This action takes an object as input with the following properties:

js
{
    datasets | object: same as UpdateVisData
    config | object: this object will contain the full kepler.gl instance configuration {mapState, mapStyle, visState}.
    key | string: dataset column 
    
}

Example

this.props.dispatch(
                wrapTo('map1', addLayerData(
                    {
                        datasets: datasets,
                        config: config,
                        key: 'stations'
                    })
                )
            );
removeLayerData

This method is similar to removeLayerData and also takes dataset key column to update the layer data. This action takes an object as input with the following properties:

js
{
    datasets | object: same as UpdateVisData
    key | string: dataset column 
    
}

Example

this.props.dispatch(
                wrapTo('map1', removeLayerData(
                    {
                        datasets: datasets,
                        key: 'stations'
                    })
                )
            );
  • Feel free to add corretions/suggestions to this PR.

rameshbabuch avatar Oct 08 '18 07:10 rameshbabuch

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 08 '18 07:10 CLAassistant

Is the intention of addLayerData to append more rows to an existing dataset? If so, naming it appendRowsToDataset would be more descriptive.

heshan0131 avatar Oct 14 '18 14:10 heshan0131