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

keplergl / kepler.gl / 16021825421

02 Jul 2025 09:48AM UTC coverage: 61.364% (-0.3%) from 61.63%
16021825421

push

github

web-flow
[fix] WMS layer fixes 1 (#3148)

* [fix] WMS layer fixes and updates

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

* wmp fixes

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

---------

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

6100 of 11820 branches covered (51.61%)

Branch coverage included in aggregate %.

1 of 11 new or added lines in 3 files covered. (9.09%)

65 existing lines in 4 files now uncovered.

12664 of 18758 relevant lines covered (67.51%)

82.15 hits per line

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

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

4
import {MapLib, MapRef} from 'react-map-gl';
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
export type MapLibInstance = MapLib<any>;
12
export type GetMapRef = ReturnType<MapRef['getMap']>;
13

14
export type BaseMapLibraryConfig = {
15
  getMapLib: () => Promise<MapLibInstance>;
16
  mapLibAttributionCssClass: string;
17
  mapLibCssClass: string;
18
  mapLibName: string;
19
  mapLibUrl: string;
20
};
21

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

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

51
  // A URL to the CDN where the kepler.gl assets are hosted.
52
  cdnUrl?: string;
53

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

72
  // WMS layer config -- Experimental
73
  // WMS layer is under development and not ready for production use. Disabled by default.
74
  enableWMSLayer?: boolean;
75
};
76

77
const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
15✔
78
  defaultHtmlName: 'kepler.gl.html',
79
  defaultImageName: 'kepler.gl.png',
80
  defaultJsonName: 'kepler.gl.json',
81
  defaultDataName: 'kepler.gl',
82
  defaultExportJsonSettings: {
83
    hasData: true
84
  },
85

86
  baseMapLibraryConfig: {
87
    maplibre: {
88
      getMapLib: () => import('maplibre-gl'),
29✔
89
      mapLibCssClass: 'maplibregl',
90
      mapLibAttributionCssClass: 'maplibre-attribution-container',
91
      mapLibName: 'MapLibre',
92
      mapLibUrl: 'https://www.maplibre.org/'
93
    },
94
    mapbox: {
UNCOV
95
      getMapLib: () => import('mapbox-gl'),
×
96
      mapLibCssClass: 'mapboxgl',
97
      mapLibAttributionCssClass: 'mapbox-attribution-container',
98
      mapLibName: 'Mapbox',
99
      mapLibUrl: 'https://www.mapbox.com/'
100
    }
101
  },
102

103
  cdnUrl: KEPLER_UNFOLDED_BUCKET,
104

105
  plugins: [],
106
  // The default table class is KeplerTable.
107
  // TODO include KeplerTable here when the circular dependency with @kepler.gl/table and @kepler.gl/utils are resolved.
108
  table: null,
109
  database: null,
110

111
  useArrowProgressiveLoading: true,
112
  showReleaseBanner: true,
113
  useOnFilteredItemsChange: false,
114

115
  // Raster Tile layer config
116
  enableRasterTileLayer: false,
117
  rasterServerUseLatestTitiler: true,
118

119
  // TODO: provide a default free server or leave blank
120
  rasterServerUrls: [],
121
  rasterServerSupportsElevation: true,
122
  rasterServerMaxRetries: 1,
123
  rasterServerRetryDelay: 10000,
124
  rasterServerServerErrorsToRetry: [503],
125
  rasterServerMaxPerServerRequests: 0,
126

127
  // WMS layer config
128
  enableWMSLayer: false
129
};
130

131
const applicationConfig: Required<KeplerApplicationConfig> = DEFAULT_APPLICATION_CONFIG;
15✔
132

133
export const getApplicationConfig = (): Required<KeplerApplicationConfig> => applicationConfig;
341✔
134

135
export function initApplicationConfig(appConfig: KeplerApplicationConfig = {}) {
×
UNCOV
136
  Object.assign(applicationConfig, appConfig);
×
137
}
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