LogoLogo
  • Welcome
  • What's new?
  • Docs
    • User guides
      • Get Started
      • Kepler.gl workflow
        • Add data to layers
          • Adding Data Layers
          • Create a Layer
          • Blend and Rearrange Layers
          • Hide, Edit and Delete Layers
        • Add Data to the Map
      • Layers
        • Point
        • S2 Layer
        • Icon
        • Line
        • Cluster
        • Polygon
        • Hexbin
        • Grid
        • H3
        • Heatmap
        • Arc
        • Trip layer
      • Layer Attributes
      • Color Palettes
      • Filters
      • Map Styles
      • Interactions
      • Map Settings
      • Time Playback
      • Save and Export
      • FAQ
    • API Reference
      • ecosystem
      • Get Started
      • Advanced usages
        • Saving and Loading Maps with Schema Manager
        • Replace UI Component with Component Dependency Injection
        • Forward Dispatch Actions
        • Reducer Plugin
        • Using Updaters
        • Custom reducer initial state
        • custom-mapbox-host
      • Components
      • Reducers
        • reducers
        • map-style
        • map-state
        • combine
        • overview
        • ui-state
        • vis-state
      • Processors
        • All processors
      • Schemas
      • Actions
        • All actions
      • Cloud providers
        • Provider
      • Custom theme
      • Localization
    • Jupyter Notebook
  • Examples
    • Node/Express
    • Demo App
    • Open modal
    • Open modal
    • UMD client
    • Customize kepler.gl Theme
    • Customize kepler.gl Reducer
  • Contributing
    • Developing Kepler.gl
    • Contributor Covenant Code of Conduct
  • Change Log
  • Upgrade Guide
Powered by GitBook
On this page

Was this helpful?

  1. Docs
  2. API Reference
  3. Reducers

map-style

PreviousreducersNextmap-state

Last updated 6 months ago

Was this helpful?

Table of Contents

mapStyleUpdaters

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

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

inputMapStyleUpdater

Input a custom map style object

Parameters

    • action.payload.inputStyle

    • action.payload.mapState

loadCustomMapStyleUpdater

Callback when a custom map style object is received

Parameters

      • action.payload.error any

    • action.payload.icon

    • action.payload.style

    • action.payload.error

loadMapStyleErrUpdater

Callback when load map style error

Parameters

    • action.payload any error

loadMapStylesUpdater

Callback when load map style success

Parameters

mapConfigChangeUpdater

Update visibleLayerGroupsto change layer group visibility

Parameters

mapStyleChangeUpdater

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

Parameters

resetMapConfigMapStyleUpdater

Reset map style config to initial state

Parameters

styleType Default: 'dark'

visibleLayerGroups Default: {}

topLayerGroups Default: {}

mapStyles mapping from style key to style object

mapboxApiAccessToken Default: null

inputStyle Default: {}

threeDBuildingColor Default: [r, g, b]

Action:

state

action

action.payload

action.payload.mapboxApiAccessToken

Returns nextState

Action:

state mapStyle

action action object

action.payload inputStyle

action.payload.url style url e.g. 'mapbox://styles/heshan/xxxxxyyyyzzz'

action.payload.id style url e.g. 'custom_style_1'

action.payload.style actual mapbox style json

action.payload.name style name

action.payload.layerGroups layer groups that can be used to set map layer visibility

action.payload.icon icon image data url

Returns nextState

Action:

state mapStyle

action

action.payload

action.payload.icon

action.payload.style

Returns nextState

Action:

state mapStyle

action

Returns nextState

Action:

state mapStyle

action

action.payload a {[id]: style} mapping

Returns nextState

Action:

state mapStyle

action

action.payload new config {visibleLayerGroups: {label: false, road: true, background: true}}

Returns nextState

Action:

state mapStyle

action

action.payload

Returns nextState

Action:

state mapStyle

Returns nextState

mapStyleUpdaters
INITIAL_MAP_STYLE
Properties
initMapStyleUpdater
inputMapStyleUpdater
loadCustomMapStyleUpdater
loadMapStyleErrUpdater
loadMapStylesUpdater
mapConfigChangeUpdater
mapStyleChangeUpdater
resetMapConfigMapStyleUpdater
Using updaters
string
Object
Object
Object
string
Object
Array
keplerGlInit
Object
Object
Object
string
Object
inputMapStyle
Object
Object
Object
string
string
Object
string
Object
Object
Object
loadCustomMapStyle
Object
Object
Object
string
Object
Object
loadMapStyleErr
Object
Object
Object
loadMapStyles
Object
Object
Object
Object
mapConfigChange
Object
Object
Object
Object
mapStyleChange
Object
Object
string
Object
resetMapConfig
Object
Object