Skip to content

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

[fix] make onFilteredItemsChange optional (#3016)

Igor Dykhta9eef01c48cd6
diff --git a/src/layers/src/base-layer.ts b/src/layers/src/base-layer.ts
index cec1a8992..34a7c6408 100644
--- a/src/layers/src/base-layer.ts
+++ b/src/layers/src/base-layer.ts
@@ -34,6 +34,7 @@ import {
import {
DataContainerInterface,
DomainQuantiles,
+ getApplicationConfig,
getLatLngBounds,
getSampleContainerData,
hasColorMap,
@@ -156,8 +157,9 @@ const MAX_SAMPLE_SIZE = 5000;
const defaultDomain: [number, number] = [0, 1];
const dataFilterExtension = new DataFilterExtension({
filterSize: MAX_GPU_FILTERS,
+ // `countItems` option. It enables the GPU to report the number of objects that pass the filter criteria via the `onFilteredItemsChange` callback.
// @ts-expect-error not typed
- countItems: true
+ countItems: getApplicationConfig().useOnFilteredItemsChange ?? false
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
diff --git a/src/utils/src/application-config.ts b/src/utils/src/application-config.ts
index 1818eaf74..195a6841d 100644
--- a/src/utils/src/application-config.ts
+++ b/src/utils/src/application-config.ts
@@ -39,6 +39,10 @@ export type KeplerApplicationConfig = {
useArrowProgressiveLoading?: boolean;
// Show built-in banner associated with the current version of Kepler.gl
showReleaseBanner?: boolean;
+ // Use the onFilteredItemsChange callback for DataFilterExtension.
+ // Enabling this option may cause performance issues when dealing with a large number of layers or sublayers,
+ // especially if large Arrow files are split into relatively small batches (should be fixed in the future).
+ useOnFilteredItemsChange?: boolean;
};
const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
@@ -73,7 +77,8 @@ const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
table: null,
useArrowProgressiveLoading: true,
- showReleaseBanner: true
+ showReleaseBanner: true,
+ useOnFilteredItemsChange: false
};
const applicationConfig: Required<KeplerApplicationConfig> = DEFAULT_APPLICATION_CONFIG;