map-style
Updaters for
mapStyle
. Can be used in your root reducer to directly modify kepler.gl's state. Read more about Using updatersExamples
import keplerGlReducer, {mapStyleUpdaters} from 'kepler.gl/reducers';
// Root Reducer
const reducers = combineReducers({
keplerGl: keplerGlReducer,
app: appReducer
});
const composedReducer = (state, action) => {
switch (action.type) {
// click button to hide label from background map
case 'CLICK_BUTTON':
return {
...state,
keplerGl: {
...state.keplerGl,
foo: {
...state.keplerGl.foo,
mapStyle: mapStyleUpdaters.mapConfigChangeUpdater(
mapStyle,
{payload: {visibleLayerGroups: {label: false, road: true, background: true}}}
)
}
}
};
}
return reducers(state, action);
};
export default composedReducer;
Default initial
mapStyle
Propagate
mapStyle
reducer with mapboxApiAccessToken
and mapStylesReplaceDefault
. if mapStylesReplaceDefault is true mapStyles is emptied; loadMapStylesUpdater() will populate mapStyles.Parameters
Input a custom map style object
Parameters
action.payload.inputStyle
action.payload.mapState
Callback when a custom map style object is received
Parameters
Callback when load map style error
Parameters
Callback when load map style success
Parameters
Update
visibleLayerGroups
to change layer group visibilityParameters
Change to another map style. The selected style should already been loaded into
mapStyle.mapStyles
Parameters
Reset map style config to initial state
Parameters
Last modified 3yr ago