@kepler.gl/utils 3.3.0-alpha.12 → 3.3.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application-config.d.ts +34 -2
- package/dist/cjs/application-config.js +8 -1
- package/dist/cjs/data-scale-utils.js +16 -2
- package/dist/cjs/extract-dataset-utils.js +195 -0
- package/dist/cjs/index.js +59 -8
- package/dist/cjs/jenks.js +156 -0
- package/dist/cjs/plot.js +21 -6
- package/dist/cjs/split-map-utils.js +19 -1
- package/dist/cjs/time.js +5 -5
- package/dist/data-scale-utils.d.ts +5 -0
- package/dist/esm/application-config.js +8 -1
- package/dist/esm/data-scale-utils.js +15 -2
- package/dist/esm/extract-dataset-utils.js +185 -0
- package/dist/esm/index.js +5 -3
- package/dist/esm/jenks.js +149 -0
- package/dist/esm/plot.js +21 -6
- package/dist/esm/split-map-utils.js +18 -1
- package/dist/esm/time.js +4 -4
- package/dist/extract-dataset-utils.d.ts +73 -0
- package/dist/index.d.ts +5 -2
- package/dist/jenks.d.ts +5 -0
- package/dist/plot.d.ts +3 -2
- package/dist/split-map-utils.d.ts +7 -0
- package/dist/time.d.ts +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Feature, ProtoDatasetField } from '@kepler.gl/types';
|
|
2
|
+
import { DataContainerInterface } from './data-container-interface';
|
|
3
|
+
export type ExtractableDataset = {
|
|
4
|
+
type?: string;
|
|
5
|
+
disableDataOperation?: boolean;
|
|
6
|
+
fields: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
format?: string;
|
|
10
|
+
analyzerType?: string;
|
|
11
|
+
displayName?: string;
|
|
12
|
+
}>;
|
|
13
|
+
dataContainer: DataContainerInterface;
|
|
14
|
+
filteredIndex?: number[];
|
|
15
|
+
filteredIdxCPU?: number[];
|
|
16
|
+
allIndexes?: number[];
|
|
17
|
+
};
|
|
18
|
+
export type ExtractableLayer = {
|
|
19
|
+
type?: string | null;
|
|
20
|
+
config: {
|
|
21
|
+
dataId: string | null;
|
|
22
|
+
label?: string;
|
|
23
|
+
isVisible?: boolean;
|
|
24
|
+
uniqueIdField?: string;
|
|
25
|
+
};
|
|
26
|
+
tileDataset?: {
|
|
27
|
+
getTiles?: () => readonly any[];
|
|
28
|
+
};
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
export type ExtractedTable = {
|
|
32
|
+
kind: 'table';
|
|
33
|
+
fields: ProtoDatasetField[];
|
|
34
|
+
rows: any[][];
|
|
35
|
+
rowCount: number;
|
|
36
|
+
};
|
|
37
|
+
export type ExtractedGeojson = {
|
|
38
|
+
kind: 'geojson';
|
|
39
|
+
features: Array<{
|
|
40
|
+
type: 'Feature';
|
|
41
|
+
id?: string | number;
|
|
42
|
+
geometry: any;
|
|
43
|
+
properties?: Record<string, any> | null;
|
|
44
|
+
}>;
|
|
45
|
+
rowCount: number;
|
|
46
|
+
};
|
|
47
|
+
export type ExtractResult = ExtractedTable | ExtractedGeojson;
|
|
48
|
+
/**
|
|
49
|
+
* Tiled raster/WMS/3D sources have no copyable rows. Vector tiles are extractable
|
|
50
|
+
* from the layer's loaded tile cache, not from dataset.rows.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isExtractableDataset(dataset?: ExtractableDataset | null): boolean;
|
|
53
|
+
export declare function isVectorTileExtractLayer(layer?: ExtractableLayer | null): boolean;
|
|
54
|
+
export declare function isExtractableLayer(layer: ExtractableLayer, datasets: Record<string, ExtractableDataset | undefined>): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Copy GeoJSON features from currently loaded vector tiles that intersect a drawing.
|
|
57
|
+
* Coverage is the current viewport/zoom tile cache, not the full tileset.
|
|
58
|
+
*/
|
|
59
|
+
export declare function extractVectorTileFeaturesInsideFeature({ layer, feature }: {
|
|
60
|
+
layer: ExtractableLayer;
|
|
61
|
+
feature: Feature | null;
|
|
62
|
+
}): ExtractedGeojson | null;
|
|
63
|
+
/**
|
|
64
|
+
* Copy in-memory rows whose geometry falls inside a drawn polygon.
|
|
65
|
+
* Existing table filters (range/select/time), including GPU-backed ones via
|
|
66
|
+
* `filteredIdxCPU`, are applied; the polygon clip is extra.
|
|
67
|
+
* Vector tiles use currently loaded viewport tiles instead of dataset.rows.
|
|
68
|
+
*/
|
|
69
|
+
export declare function extractRowsInsideFeature({ layer, dataset, feature }: {
|
|
70
|
+
layer: ExtractableLayer;
|
|
71
|
+
dataset: ExtractableDataset;
|
|
72
|
+
feature: Feature | null;
|
|
73
|
+
}): ExtractResult | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { adjustValueToAnimationWindow, getBinThresholds, histogramFromThreshold,
|
|
|
10
10
|
export * from './data-utils';
|
|
11
11
|
export type { FieldFormatter } from './data-utils';
|
|
12
12
|
export * from './strings';
|
|
13
|
-
export { SAMPLE_TIMELINE, TIMELINE_MODES, TIME_INTERVALS_ORDERED, LayerToFilterTimeInterval,
|
|
13
|
+
export { SAMPLE_TIMELINE, TIMELINE_MODES, TIME_INTERVALS_ORDERED, LayerToFilterTimeInterval, LayerTimeInterval, getTimelineFromAnimationConfig, getTimelineFromFilter, filterIntervalOptions } from './time';
|
|
14
14
|
export { maybeHexToGeo, getPositionFromHexValue } from './position-utils';
|
|
15
15
|
export { datasetColorMaker, findDefaultColorField, getFieldFormatLabels, getFormatLabels, validateInputData } from './dataset-utils';
|
|
16
16
|
export { exportMapToHTML } from './export-map-html';
|
|
@@ -38,7 +38,9 @@ export * from './filter-utils';
|
|
|
38
38
|
export type { FilterChanged, FilterResult, dataValueAccessor } from './filter-utils';
|
|
39
39
|
export * from './editor-feature-utils';
|
|
40
40
|
export type { EditorFeatureCollection } from './editor-feature-utils';
|
|
41
|
-
export {
|
|
41
|
+
export { extractRowsInsideFeature, extractVectorTileFeaturesInsideFeature, isExtractableDataset, isExtractableLayer, isVectorTileExtractLayer } from './extract-dataset-utils';
|
|
42
|
+
export type { ExtractableDataset, ExtractableLayer, ExtractedGeojson, ExtractedTable, ExtractResult } from './extract-dataset-utils';
|
|
43
|
+
export { colorMapToColorBreaks, colorBreaksToColorMap, getLayerColorScale, getLegendOfScale, getJenksDomain, getLinearDomain, getLogDomain, getOrdinalDomain, getQuantileDomain, getScaleFunction, getVisualChannelScaleByZoom, initializeLayerColorMap, isNumericColorBreaks, isDomainStops, isDomainQuantile, getDomainStepsbyZoom, getThresholdsFromQuantiles, getQuantLabelFormat, getHistogramDomain, getQuantLegends, getCategoricalColorMap, getCategoricalColorScale, initCustomPaletteByCustomScale, colorMapToCategoricalColorBreaks, resetCategoricalColorMapByIndex, selectRestCategoricalColorMapByIndex, removeCategoricalValueFromColorMap, addCategoricalValuesToColorMap } from './data-scale-utils';
|
|
42
44
|
export type { ColorBreak, ColorBreakOrdinal, DomainQuantiles, DomainStops } from './data-scale-utils';
|
|
43
45
|
export { DataRow } from './data-row';
|
|
44
46
|
export { getApplicationConfig, initApplicationConfig } from './application-config';
|
|
@@ -46,6 +48,7 @@ export type { KeplerApplicationConfig, KeplerAcceptedFileFormat, BaseMapLibraryC
|
|
|
46
48
|
export type { DatabaseAdapter, DatabaseConnection } from './application-config-types';
|
|
47
49
|
export { isAppleDevice } from './browser-utils';
|
|
48
50
|
export { default as quickInsertionSort } from './quick-insertion-sort';
|
|
51
|
+
export { default as naturalBreaks } from './jenks';
|
|
49
52
|
export type { KeplerTableModel } from './types';
|
|
50
53
|
export { valueToPosition, positionToValue, createSliderScale } from './slider-scale-utils';
|
|
51
54
|
export type { SliderScaleConfig } from './slider-scale-utils';
|
package/dist/jenks.d.ts
ADDED
package/dist/plot.d.ts
CHANGED
|
@@ -50,9 +50,10 @@ export declare function getBinThresholds(interval: string, domain: number[]): nu
|
|
|
50
50
|
* Run GPU filter on current filter result to generate indexes for ploting chart
|
|
51
51
|
* Skip ruuning for the same field
|
|
52
52
|
* @param dataset
|
|
53
|
-
* @param filter
|
|
53
|
+
* @param filter Histogram filter whose dataId-paired column should be skipped
|
|
54
|
+
* @param skipFieldNames Extra GPU field names to skip (charts cross-filter). Histogram callers omit this.
|
|
54
55
|
*/
|
|
55
|
-
export declare function runGpuFilterForPlot<K extends KeplerTableModel<K, L>, L>(dataset: K, filter?: Filter): number[];
|
|
56
|
+
export declare function runGpuFilterForPlot<K extends KeplerTableModel<K, L>, L>(dataset: K, filter?: Filter, skipFieldNames?: string[]): number[];
|
|
56
57
|
export declare function getFilterDataFunc(filterRange: any, getFilterValue: any, dataContainer: DataContainerInterface, skips: any): (index: any) => any;
|
|
57
58
|
export declare function validBin(b: any): boolean;
|
|
58
59
|
/**
|
|
@@ -19,6 +19,13 @@ export declare function removeLayerFromSplitMaps(splitMaps: any, layer: any): an
|
|
|
19
19
|
* @returns {Array<Object>} layer visibility for each panel
|
|
20
20
|
*/
|
|
21
21
|
export declare function getInitialMapLayersForSplitMap(layers: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* Combine the layers of the split map panels at the same index
|
|
24
|
+
* @param {Array<Object>} baseSplitMaps
|
|
25
|
+
* @param {Array<Object>} splitMaps layers override the ones of baseSplitMaps
|
|
26
|
+
* @returns {Array<Object>} new splitMaps, without holes
|
|
27
|
+
*/
|
|
28
|
+
export declare function combineSplitMapsByIndex(baseSplitMaps: any, splitMaps: any): any[];
|
|
22
29
|
/**
|
|
23
30
|
* This method will get default splitMap settings based on existing layers
|
|
24
31
|
* @param {Array<Object>} layers
|
package/dist/time.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kepler.gl/utils",
|
|
3
3
|
"author": "Shan He <shan@uber.com>",
|
|
4
|
-
"version": "3.3.0-alpha.
|
|
4
|
+
"version": "3.3.0-alpha.14",
|
|
5
5
|
"description": "kepler.gl constants used by kepler.gl components, actions and reducers",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@deck.gl/core": "^9.3.1",
|
|
32
|
-
"@kepler.gl/common-utils": "3.3.0-alpha.
|
|
33
|
-
"@kepler.gl/constants": "3.3.0-alpha.
|
|
34
|
-
"@kepler.gl/types": "3.3.0-alpha.
|
|
32
|
+
"@kepler.gl/common-utils": "3.3.0-alpha.14",
|
|
33
|
+
"@kepler.gl/constants": "3.3.0-alpha.14",
|
|
34
|
+
"@kepler.gl/types": "3.3.0-alpha.14",
|
|
35
35
|
"@loaders.gl/gis": "^4.4.1",
|
|
36
36
|
"@luma.gl/constants": "^9.3.2",
|
|
37
37
|
"@luma.gl/core": "^9.3.2",
|
|
38
38
|
"@mapbox/geo-viewport": "^0.4.1",
|
|
39
|
+
"@turf/boolean-intersects": "^7.2.0",
|
|
39
40
|
"@turf/boolean-within": "^7.2.0",
|
|
40
41
|
"@turf/helpers": "^7.2.0",
|
|
41
42
|
"@types/d3-array": "^2.8.0",
|