• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keplergl / kepler.gl / 25178462165

30 Apr 2026 05:00PM UTC coverage: 59.41% (-0.02%) from 59.425%
25178462165

push

github

web-flow
fix: integrate Maplibre support and update dependencies (#3395)

* integrate Maplibre support and update dependencies

- Added support for Maplibre by introducing a new Map component from @vis.gl/react-maplibre.
- Updated the MapComponent prop to allow selection between Mapbox and Maplibre.
- Updated package.json to include @vis.gl/react-maplibre and adjusted react-map-gl versioning.
- Cleaned up imports and adjusted map properties to accommodate the new library integration.

* chore: synchronize @vis.gl/react-maplibre version in package.json and yarn.lock

- Updated package.json and yarn.lock to ensure consistent versioning of @vis.gl/react-maplibre to 8.1.1.

* address comments

* fix build error

* fix website build

* fix lint

6903 of 13951 branches covered (49.48%)

Branch coverage included in aggregate %.

7 of 13 new or added lines in 2 files covered. (53.85%)

3 existing lines in 3 files now uncovered.

14247 of 21649 relevant lines covered (65.81%)

80.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/utils/src/application-config.ts
1
// SPDX-License-Identifier: MIT
2
// Copyright contributors to the kepler.gl project
3

4
import type {MapLib, MapRef} from 'react-map-gl/mapbox-legacy';
5

6
import {KEPLER_UNFOLDED_BUCKET} from '@kepler.gl/constants';
7
import type {BaseMapLibraryType} from '@kepler.gl/constants';
8

9
import type {DatabaseAdapter} from './application-config-types';
10

11
/**
12
 * Detect if running with webpack build tool
13
 */
14
function isWebpackBuild(): boolean {
15
  // @ts-ignore - __webpack_require__ is injected by webpack at runtime
16
  return typeof __webpack_require__ !== 'undefined';
17✔
17
}
18

19
export type MapLibInstance = MapLib;
20
export type GetMapRef = ReturnType<MapRef['getMap']>;
21

22
export type BaseMapLibraryConfig = {
23
  getMapLib: () => Promise<MapLibInstance>;
24
  mapLibAttributionCssClass: string;
25
  mapLibCssClass: string;
26
  mapLibName: string;
27
  mapLibUrl: string;
28
};
29

30
/**
31
 * A mechanism to override default Kepler values/settings so that we
32
 * without having to make application-specific changes to the kepler repo.
33
 */
34
export type KeplerApplicationConfig = {
35
  /** Default name of export HTML file, can be overridden by user */
36
  defaultHtmlName?: string;
37
  defaultImageName?: string;
38
  defaultJsonName?: string;
39
  defaultDataName?: string;
40
  defaultExportJsonSettings?: {
41
    hasData?: boolean;
42
  };
43
  baseMapLibraryConfig?: Record<BaseMapLibraryType, BaseMapLibraryConfig>;
44
  plugins?: any[];
45
  // KeplerTable alternative
46
  // TODO improve typing by exporting KeplerTable interface to @kepler.gl/types
47
  table?: any;
48
  database?: DatabaseAdapter | null;
49

50
  // Disable progressive loading for arrow files
51
  useArrowProgressiveLoading?: boolean;
52
  // Show built-in banner associated with the current version of Kepler.gl
53
  showReleaseBanner?: boolean;
54
  // Use the onFilteredItemsChange callback for DataFilterExtension.
55
  // Enabling this option may cause performance issues when dealing with a large number of layers or sublayers,
56
  // especially if large Arrow files are split into relatively small batches (should be fixed in the future).
57
  useOnFilteredItemsChange?: boolean;
58

59
  // A URL to the CDN where the kepler.gl assets are hosted.
60
  cdnUrl?: string;
61

62
  // Raster Tile layer config
63
  // Raster Tile layer is under development and not ready for production use. Disabled by default.
64
  enableRasterTileLayer?: boolean;
65
  /** Whether to use Titiler v0.21 API endpoints instead of v0.11 */
66
  rasterServerUseLatestTitiler?: boolean;
67
  /** An array of URLs to shards of the raster tile server to be used by the raster tile layer. */
68
  rasterServerUrls?: string[];
69
  /** If true then try to fetch quantized elevation meshes from raster servers */
70
  rasterServerSupportsElevation?: boolean;
71
  /** How many times to retry a request if case of rasterServerServerErrorsToRetry errors */
72
  rasterServerMaxRetries?: number;
73
  /** How long between retries */
74
  rasterServerRetryDelay?: number;
75
  /** An array of HTTP status codes that should be retried when encountered. */
76
  rasterServerServerErrorsToRetry?: number[];
77
  /** Maximum number of simultaneous requests per raster server. 0 - no limit */
78
  rasterServerMaxPerServerRequests?: number;
79
  /** Whether to show the server input field in the raster tile layer setup form */
80
  rasterServerShowServerInput?: boolean;
81

82
  // WMS layer config -- Experimental
83
  // WMS layer is under development and not ready for production use. Disabled by default.
84
  enableWMSLayer?: boolean;
85

86
  // Flow layer config
87
  enableFlowLayer?: boolean;
88

89
  /** Whether to show example URLs in tileset setup forms (vector tile, raster tile, WMS, 3D tile) */
90
  showInlineTilesetExamples?: boolean;
91

92
  // Image export config
93
  /** Whether to apply fix for uglify error in dom-to-image (should be true for webpack builds, false for Vite) */
94
  escapeXhtmlForWebpack?: boolean;
95

96
  /** Maximum pitch angle in degrees. deck.gl defaults to 60; set higher (up to 85) for elevated perspectives.
97
   *  Note: values above 60 may cause rendering artifacts with some basemap tile providers. */
98
  maxPitch?: number;
99
};
100

101
const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
17✔
102
  defaultHtmlName: 'kepler.gl.html',
103
  defaultImageName: 'kepler.gl.png',
104
  defaultJsonName: 'kepler.gl.json',
105
  defaultDataName: 'kepler.gl',
106
  defaultExportJsonSettings: {
107
    hasData: true
108
  },
109

110
  baseMapLibraryConfig: {
111
    maplibre: {
UNCOV
112
      getMapLib: () => import('maplibre-gl') as unknown as Promise<MapLibInstance>,
×
113
      mapLibCssClass: 'maplibregl',
114
      mapLibAttributionCssClass: 'maplibre-attribution-container',
115
      mapLibName: 'MapLibre',
116
      mapLibUrl: 'https://www.maplibre.org/'
117
    },
118
    mapbox: {
119
      getMapLib: () => import('mapbox-gl'),
×
120
      mapLibCssClass: 'mapboxgl',
121
      mapLibAttributionCssClass: 'mapbox-attribution-container',
122
      mapLibName: 'Mapbox',
123
      mapLibUrl: 'https://www.mapbox.com/'
124
    }
125
  },
126

127
  cdnUrl: KEPLER_UNFOLDED_BUCKET,
128

129
  plugins: [],
130
  // The default table class is KeplerTable.
131
  // TODO include KeplerTable here when the circular dependency with @kepler.gl/table and @kepler.gl/utils are resolved.
132
  table: null,
133
  database: null,
134

135
  useArrowProgressiveLoading: true,
136
  showReleaseBanner: true,
137
  useOnFilteredItemsChange: false,
138

139
  // Raster Tile layer config
140
  enableRasterTileLayer: true,
141
  rasterServerUseLatestTitiler: true,
142
  rasterServerShowServerInput: true,
143
  rasterServerUrls: [], // TODO: provide a default free server or leave blank
144
  rasterServerSupportsElevation: true,
145
  rasterServerMaxRetries: 1,
146
  rasterServerRetryDelay: 10000,
147
  rasterServerServerErrorsToRetry: [503],
148
  rasterServerMaxPerServerRequests: 0,
149

150
  // WMS layer config
151
  enableWMSLayer: true,
152

153
  // Flow layer config
154
  enableFlowLayer: true,
155

156
  showInlineTilesetExamples: true,
157

158
  // Image export config
159
  // Default to true for webpack builds, false for other build tools (e.g., Vite)
160
  escapeXhtmlForWebpack: isWebpackBuild(),
161

162
  maxPitch: 60
163
};
164

165
const applicationConfig: Required<KeplerApplicationConfig> = DEFAULT_APPLICATION_CONFIG;
17✔
166

167
export const getApplicationConfig = (): Required<KeplerApplicationConfig> => applicationConfig;
438✔
168

169
export function initApplicationConfig(appConfig: KeplerApplicationConfig = {}) {
×
170
  Object.assign(applicationConfig, appConfig);
×
171
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc