map-style

Table of Contents

mapStyleUpdaters

Updaters for mapStyle. Can be used in your root reducer to directly modify kepler.gl's state. Read more about Using updatersarrow-up-right

Examples

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;

INITIAL_MAP_STYLE

Default initial mapStyle

Properties

initMapStyleUpdater

Propagate mapStyle reducer with mapboxApiAccessToken and mapStylesReplaceDefault. if mapStylesReplaceDefault is true mapStyles is emptied; loadMapStylesUpdater() will populate mapStyles.

Parameters

Returns Objectarrow-up-right nextState

inputMapStyleUpdater

Input a custom map style object

Parameters

Returns Objectarrow-up-right nextState

loadCustomMapStyleUpdater

Callback when a custom map style object is received

Parameters

Returns Objectarrow-up-right nextState

loadMapStyleErrUpdater

Callback when load map style error

Parameters

Returns Objectarrow-up-right nextState

loadMapStylesUpdater

Callback when load map style success

Parameters

Returns Objectarrow-up-right nextState

mapConfigChangeUpdater

Update visibleLayerGroupsto change layer group visibility

Parameters

Returns Objectarrow-up-right nextState

mapStyleChangeUpdater

Change to another map style. The selected style should already been loaded into mapStyle.mapStyles

Parameters

Returns Objectarrow-up-right nextState

resetMapConfigMapStyleUpdater

Reset map style config to initial state

Parameters

Returns Objectarrow-up-right nextState

Last updated

Was this helpful?