kepler.gl
kepler.gl copied to clipboard
Add/Remove Layer Data
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.
Is the intention of addLayerData
to append more rows to an existing dataset? If so, naming it appendRowsToDataset
would be more descriptive.