Kepler.gl is built on top of Mapbox GL. A mapbox account and an access token are needed to use kepler.gl in your app. Get a Mapbox Access Token at mapbox.com.
Basic Usage
1. Mount reducer
Kepler.gl uses Redux to manage its internal state, along with react-palm middleware to handle side effects. Mount kepler.gl reducer in your store, apply taskMiddleware.
import keplerGlReducer from'@kepler.gl/reducers';import {createStore, combineReducers, applyMiddleware} from'redux';import {taskMiddleware} from'react-palm/tasks';constreducer=combineReducers({// <-- mount kepler.gl reducer in your app keplerGl: keplerGlReducer,// Your other reducers here app: appReducer});// create storeconststore=createStore(reducer, {},applyMiddleware(taskMiddleware));
If you mount keplerGlReducer in another address instead of keplerGl, or it is not mounted at root of your reducer, you will need to specify the path to it when you mount the component with the getState prop.
In order to interact with a kepler.gl instance and add new data to it, you can dispatch the addDataToMap action from anywhere inside your app. It adds dataset(s) to a kepler.gl instance and updates the full configuration (mapState, mapStyle, visState).