Search…
map-state

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
1
import keplerGlReducer, {mapStateUpdaters} from 'kepler.gl/reducers';
2
// Root Reducer
3
const reducers = combineReducers({
4
keplerGl: keplerGlReducer,
5
app: appReducer
6
});
7
8
const composedReducer = (state, action) => {
9
switch (action.type) {
10
// click button to close side panel
11
case 'CLICK_BUTTON':
12
return {
13
...state,
14
keplerGl: {
15
...state.keplerGl,
16
foo: {
17
...state.keplerGl.foo,
18
mapState: mapStateUpdaters.fitBoundsUpdater(
19
mapState, {payload: [127.34, 31.09, 127.56, 31.59]]}
20
)
21
}
22
}
23
};
24
}
25
return reducers(state, action);
26
};
27
28
export default composedReducer;
Copied!

fitBoundsUpdater

Fit map viewport to bounds
Parameters
Returns Object nextState

INITIAL_MAP_STATE

Default initial mapState

Properties

receiveMapConfigUpdater

Update mapState to propagate a new config
Parameters
    state Object
    action Object
      action.payload Object saved map config
      action.payload.config (optional, default {})
      action.payload.options (optional, default {})
      action.payload.bounds (optional, default null)
Returns Object nextState

resetMapConfigUpdater

reset mapState to initial State
Parameters
Returns Object nextState

togglePerspectiveUpdater

Toggle between 3d and 2d map.
Parameters
Returns Object nextState

toggleSplitMapUpdater

Toggle between one or split maps
Parameters
Returns Object nextState

updateMapUpdater

Update map viewport
Parameters
Returns Object nextState
Last modified 1yr ago