Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Feat] Use custom style token if available instead of the default token (#1913)

Igor Dykhtaf82494d60a14
diff --git a/src/components/map-container.tsx b/src/components/map-container.tsx
index 19c648896..71e9741d1 100644
--- a/src/components/map-container.tsx
+++ b/src/components/map-container.tsx
@@ -583,12 +583,14 @@ export default function MapContainerFactory(
const layersToRender = this.layersToRenderSelector(this.props);
const layersForDeck = this.layersForDeckSelector(this.props);
+ // Current style can be a custom style, from which we pull the mapbox API acccess token
+ const currentStyle = mapStyle.mapStyles?.[mapStyle.styleType];
const mapProps = {
...mapState,
width: '100%',
height: '100%',
preserveDrawingBuffer: true,
- mapboxApiAccessToken,
+ mapboxApiAccessToken: currentStyle?.accessToken || mapboxApiAccessToken,
mapboxApiUrl,
onViewportChange: this._onViewportChange,
transformRequest
diff --git a/src/reducers/map-style-updaters.ts b/src/reducers/map-style-updaters.ts
index 02bf3145b..45e639e59 100644
--- a/src/reducers/map-style-updaters.ts
+++ b/src/reducers/map-style-updaters.ts
@@ -66,6 +66,7 @@ export type BaseMapStyle = {
icon: string;
style?: Object;
layerGroups: LayerGroup[];
+ accessToken?: string;
};
export type MapStyles = {