Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Table of Contents
mapStateUpdaters
Updaters for mapState reducer. Can be used in your root reducer to directly modify kepler.gl's state.
Read more about Using updaters
Examples
import keplerGlReducer, {mapStateUpdaters} from '@kepler.gl/reducers';
// Root Reducer
const reducers = combineReducers({
keplerGl: keplerGlReducer,
app: appReducer
});
const composedReducer = (state, action) => {
switch (action.type) {
// click button to close side panel
case 'CLICK_BUTTON':
return {
...state,
keplerGl: {
...state.keplerGl,
foo: {
...state.keplerGl.foo,
mapState: mapStateUpdaters.fitBoundsUpdater(
state.keplerGl.foo.mapState, {payload: [127.34, 31.09, 127.56, 31.59]}
)
}
}
};
}
return reducers(state, action);
};
export default composedReducer;
fitBoundsUpdater
Fit map viewport to bounds
- Action:
fitBounds
Parameters
Returns Object nextState
INITIAL_MAP_STATE
Default initial mapState
Properties
pitchnumber Default:0bearingnumber Default:0latitudenumber Default:37.75043longitudenumber Default:-122.34679zoomnumber Default:9dragRotateboolean Default:falsewidthnumber Default:800heightnumber Default:800isSplitboolean Default:false
receiveMapConfigUpdater
Update mapState to propagate a new config
- Action:
receiveMapConfig
Parameters
stateObjectactionObjectaction.payloadObject saved map configaction.payload.config(optional, default{})action.payload.options(optional, default{})action.payload.bounds(optional, defaultnull)
Returns Object nextState
resetMapConfigUpdater
reset mapState to initial State
- Action:
resetMapConfig
Parameters
stateObjectmapState
Returns Object nextState
togglePerspectiveUpdater
Toggle between 3d and 2d map.
- Action:
togglePerspective
Parameters
stateObject
Returns Object nextState
toggleSplitMapUpdater
Toggle between one or split maps
- Action:
toggleSplitMap
Parameters
stateObject
Returns Object nextState
updateMapUpdater
Update map viewport
- Action:
updateMap
Parameters
Returns Object nextState