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

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(
mapState, {payload: [127.34, 31.09, 127.56, 31.59]]}
)
}
}
};
}
return reducers(state, action);
};
export default composedReducer;

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