@deck.gl/carto 9.0.23 → 9.0.25

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.
Files changed (72) hide show
  1. package/dist/api/layer-map.d.ts +4 -6
  2. package/dist/api/layer-map.d.ts.map +1 -1
  3. package/dist/api/layer-map.js +16 -17
  4. package/dist/cartoRasterTile-worker.js +1 -1
  5. package/dist/cartoSpatialTile-worker.js +1 -1
  6. package/dist/cartoVectorTile-worker.js +1 -1
  7. package/dist/dist.dev.js +1631 -1195
  8. package/dist/index.cjs +798 -512
  9. package/dist/index.cjs.map +4 -4
  10. package/dist/index.d.ts +3 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -1
  13. package/dist/layers/cluster-tile-layer.d.ts +41 -0
  14. package/dist/layers/cluster-tile-layer.d.ts.map +1 -0
  15. package/dist/layers/cluster-tile-layer.js +116 -0
  16. package/dist/layers/cluster-utils.d.ts +30 -0
  17. package/dist/layers/cluster-utils.d.ts.map +1 -0
  18. package/dist/layers/cluster-utils.js +122 -0
  19. package/dist/layers/raster-layer.d.ts +21 -1
  20. package/dist/layers/raster-layer.d.ts.map +1 -1
  21. package/dist/layers/raster-layer.js +31 -1
  22. package/dist/layers/raster-tile-layer.d.ts +2 -2
  23. package/dist/layers/raster-tile-layer.d.ts.map +1 -1
  24. package/dist/layers/raster-tile-layer.js +2 -2
  25. package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
  26. package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
  27. package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
  28. package/dist/layers/spatial-index-tile-layer.d.ts +2 -5
  29. package/dist/layers/spatial-index-tile-layer.d.ts.map +1 -1
  30. package/dist/layers/vector-tile-layer.d.ts.map +1 -1
  31. package/dist/layers/vector-tile-layer.js +10 -2
  32. package/dist/sources/h3-query-source.d.ts +2 -2
  33. package/dist/sources/h3-query-source.d.ts.map +1 -1
  34. package/dist/sources/h3-query-source.js +4 -1
  35. package/dist/sources/h3-table-source.d.ts +2 -2
  36. package/dist/sources/h3-table-source.d.ts.map +1 -1
  37. package/dist/sources/h3-table-source.js +4 -1
  38. package/dist/sources/quadbin-query-source.d.ts +2 -2
  39. package/dist/sources/quadbin-query-source.d.ts.map +1 -1
  40. package/dist/sources/quadbin-query-source.js +4 -1
  41. package/dist/sources/quadbin-table-source.d.ts +2 -2
  42. package/dist/sources/quadbin-table-source.d.ts.map +1 -1
  43. package/dist/sources/quadbin-table-source.js +4 -1
  44. package/dist/style/color-bins-style.d.ts +1 -2
  45. package/dist/style/color-bins-style.d.ts.map +1 -1
  46. package/dist/style/color-categories-style.d.ts +1 -2
  47. package/dist/style/color-categories-style.d.ts.map +1 -1
  48. package/dist/style/color-continuous-style.d.ts +1 -2
  49. package/dist/style/color-continuous-style.d.ts.map +1 -1
  50. package/dist/style/palette.d.ts +1 -1
  51. package/dist/style/palette.d.ts.map +1 -1
  52. package/dist/utils.d.ts.map +1 -1
  53. package/dist/utils.js +6 -0
  54. package/dist.min.js +10 -10
  55. package/package.json +2 -2
  56. package/src/api/layer-map.ts +30 -29
  57. package/src/index.ts +3 -0
  58. package/src/layers/cluster-tile-layer.ts +218 -0
  59. package/src/layers/cluster-utils.ts +160 -0
  60. package/src/layers/raster-layer.ts +45 -2
  61. package/src/layers/raster-tile-layer.ts +3 -3
  62. package/src/layers/spatial-index-tile-layer.ts +2 -2
  63. package/src/layers/vector-tile-layer.ts +11 -2
  64. package/src/sources/h3-query-source.ts +11 -2
  65. package/src/sources/h3-table-source.ts +11 -2
  66. package/src/sources/quadbin-query-source.ts +11 -2
  67. package/src/sources/quadbin-table-source.ts +11 -2
  68. package/src/style/color-bins-style.ts +2 -2
  69. package/src/style/color-categories-style.ts +2 -2
  70. package/src/style/color-continuous-style.ts +2 -2
  71. package/src/style/palette.ts +1 -2
  72. package/src/utils.ts +8 -0
@@ -3,13 +3,17 @@ import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants';
3
3
  import {baseSource} from './base-source';
4
4
  import type {
5
5
  AggregationOptions,
6
+ FilterOptions,
6
7
  QuerySourceOptions,
7
8
  SourceOptions,
8
9
  SpatialDataType,
9
10
  TilejsonResult
10
11
  } from './types';
11
12
 
12
- export type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions;
13
+ export type H3QuerySourceOptions = SourceOptions &
14
+ QuerySourceOptions &
15
+ AggregationOptions &
16
+ FilterOptions;
13
17
  type UrlParameters = {
14
18
  aggregationExp: string;
15
19
  aggregationResLevel?: string;
@@ -17,6 +21,7 @@ type UrlParameters = {
17
21
  spatialDataColumn?: string;
18
22
  q: string;
19
23
  queryParameters?: Record<string, unknown> | unknown[];
24
+ filters?: Record<string, unknown>;
20
25
  };
21
26
 
22
27
  export const h3QuerySource = async function (
@@ -27,7 +32,8 @@ export const h3QuerySource = async function (
27
32
  aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
28
33
  sqlQuery,
29
34
  spatialDataColumn = 'h3',
30
- queryParameters
35
+ queryParameters,
36
+ filters
31
37
  } = options;
32
38
  const urlParameters: UrlParameters = {
33
39
  aggregationExp,
@@ -42,5 +48,8 @@ export const h3QuerySource = async function (
42
48
  if (queryParameters) {
43
49
  urlParameters.queryParameters = queryParameters;
44
50
  }
51
+ if (filters) {
52
+ urlParameters.filters = filters;
53
+ }
45
54
  return baseSource<UrlParameters>('query', options, urlParameters) as Promise<TilejsonResult>;
46
55
  };
@@ -3,13 +3,17 @@ import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants';
3
3
  import {baseSource} from './base-source';
4
4
  import type {
5
5
  AggregationOptions,
6
+ FilterOptions,
6
7
  SourceOptions,
7
8
  SpatialDataType,
8
9
  TableSourceOptions,
9
10
  TilejsonResult
10
11
  } from './types';
11
12
 
12
- export type H3TableSourceOptions = SourceOptions & TableSourceOptions & AggregationOptions;
13
+ export type H3TableSourceOptions = SourceOptions &
14
+ TableSourceOptions &
15
+ AggregationOptions &
16
+ FilterOptions;
13
17
 
14
18
  type UrlParameters = {
15
19
  aggregationExp: string;
@@ -17,6 +21,7 @@ type UrlParameters = {
17
21
  spatialDataType: SpatialDataType;
18
22
  spatialDataColumn?: string;
19
23
  name: string;
24
+ filters?: Record<string, unknown>;
20
25
  };
21
26
 
22
27
  export const h3TableSource = async function (
@@ -26,7 +31,8 @@ export const h3TableSource = async function (
26
31
  aggregationExp,
27
32
  aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
28
33
  spatialDataColumn = 'h3',
29
- tableName
34
+ tableName,
35
+ filters
30
36
  } = options;
31
37
  const urlParameters: UrlParameters = {
32
38
  aggregationExp,
@@ -38,5 +44,8 @@ export const h3TableSource = async function (
38
44
  if (aggregationResLevel) {
39
45
  urlParameters.aggregationResLevel = String(aggregationResLevel);
40
46
  }
47
+ if (filters) {
48
+ urlParameters.filters = filters;
49
+ }
41
50
  return baseSource<UrlParameters>('table', options, urlParameters) as Promise<TilejsonResult>;
42
51
  };
@@ -3,13 +3,17 @@ import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants';
3
3
  import {baseSource} from './base-source';
4
4
  import type {
5
5
  AggregationOptions,
6
+ FilterOptions,
6
7
  QuerySourceOptions,
7
8
  SourceOptions,
8
9
  SpatialDataType,
9
10
  TilejsonResult
10
11
  } from './types';
11
12
 
12
- export type QuadbinQuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions;
13
+ export type QuadbinQuerySourceOptions = SourceOptions &
14
+ QuerySourceOptions &
15
+ AggregationOptions &
16
+ FilterOptions;
13
17
 
14
18
  type UrlParameters = {
15
19
  aggregationExp: string;
@@ -18,6 +22,7 @@ type UrlParameters = {
18
22
  spatialDataColumn?: string;
19
23
  q: string;
20
24
  queryParameters?: Record<string, unknown> | unknown[];
25
+ filters?: Record<string, unknown>;
21
26
  };
22
27
 
23
28
  export const quadbinQuerySource = async function (
@@ -28,7 +33,8 @@ export const quadbinQuerySource = async function (
28
33
  aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
29
34
  sqlQuery,
30
35
  spatialDataColumn = 'quadbin',
31
- queryParameters
36
+ queryParameters,
37
+ filters
32
38
  } = options;
33
39
  const urlParameters: UrlParameters = {
34
40
  aggregationExp,
@@ -43,5 +49,8 @@ export const quadbinQuerySource = async function (
43
49
  if (queryParameters) {
44
50
  urlParameters.queryParameters = queryParameters;
45
51
  }
52
+ if (filters) {
53
+ urlParameters.filters = filters;
54
+ }
46
55
  return baseSource<UrlParameters>('query', options, urlParameters) as Promise<TilejsonResult>;
47
56
  };
@@ -3,13 +3,17 @@ import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants';
3
3
  import {baseSource} from './base-source';
4
4
  import type {
5
5
  AggregationOptions,
6
+ FilterOptions,
6
7
  SourceOptions,
7
8
  SpatialDataType,
8
9
  TableSourceOptions,
9
10
  TilejsonResult
10
11
  } from './types';
11
12
 
12
- export type QuadbinTableSourceOptions = SourceOptions & TableSourceOptions & AggregationOptions;
13
+ export type QuadbinTableSourceOptions = SourceOptions &
14
+ TableSourceOptions &
15
+ AggregationOptions &
16
+ FilterOptions;
13
17
 
14
18
  type UrlParameters = {
15
19
  aggregationExp: string;
@@ -17,6 +21,7 @@ type UrlParameters = {
17
21
  spatialDataType: SpatialDataType;
18
22
  spatialDataColumn?: string;
19
23
  name: string;
24
+ filters?: Record<string, unknown>;
20
25
  };
21
26
 
22
27
  export const quadbinTableSource = async function (
@@ -26,7 +31,8 @@ export const quadbinTableSource = async function (
26
31
  aggregationExp,
27
32
  aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
28
33
  spatialDataColumn = 'quadbin',
29
- tableName
34
+ tableName,
35
+ filters
30
36
  } = options;
31
37
 
32
38
  const urlParameters: UrlParameters = {
@@ -39,5 +45,8 @@ export const quadbinTableSource = async function (
39
45
  if (aggregationResLevel) {
40
46
  urlParameters.aggregationResLevel = String(aggregationResLevel);
41
47
  }
48
+ if (filters) {
49
+ urlParameters.filters = filters;
50
+ }
42
51
  return baseSource<UrlParameters>('table', options, urlParameters) as Promise<TilejsonResult>;
43
52
  };
@@ -1,7 +1,7 @@
1
1
  import {scaleThreshold} from 'd3-scale';
2
- import {AccessorFunction} from '@deck.gl/core';
2
+ import {AccessorFunction, Color} from '@deck.gl/core';
3
3
  import {Feature} from 'geojson';
4
- import getPalette, {Color, DEFAULT_PALETTE, NULL_COLOR} from './palette';
4
+ import getPalette, {DEFAULT_PALETTE, NULL_COLOR} from './palette';
5
5
  import {assert} from '../utils';
6
6
  import {AttributeSelector, getAttrValue} from './utils';
7
7
 
@@ -1,6 +1,6 @@
1
- import {AccessorFunction} from '@deck.gl/core';
1
+ import {AccessorFunction, Color} from '@deck.gl/core';
2
2
  import {Feature} from 'geojson';
3
- import getPalette, {Color, DEFAULT_PALETTE, NULL_COLOR, OTHERS_COLOR} from './palette';
3
+ import getPalette, {DEFAULT_PALETTE, NULL_COLOR, OTHERS_COLOR} from './palette';
4
4
  import {assert} from '../utils';
5
5
  import {AttributeSelector, getAttrValue} from './utils';
6
6
 
@@ -1,7 +1,7 @@
1
- import {AccessorFunction} from '@deck.gl/core';
1
+ import {AccessorFunction, Color} from '@deck.gl/core';
2
2
  import {scaleLinear} from 'd3-scale';
3
3
  import {Feature} from 'geojson';
4
- import getPalette, {Color, DEFAULT_PALETTE, NULL_COLOR} from './palette';
4
+ import getPalette, {DEFAULT_PALETTE, NULL_COLOR} from './palette';
5
5
  import {assert} from '../utils';
6
6
  import {AttributeSelector, getAttrValue} from './utils';
7
7
 
@@ -1,7 +1,6 @@
1
1
  import * as cartoColors from 'cartocolor';
2
2
  import {assert} from '../utils';
3
-
4
- export type Color = [r: number, b: number, g: number, a?: number];
3
+ import {Color} from '@deck.gl/core';
5
4
 
6
5
  export const DEFAULT_PALETTE = 'PurpOr';
7
6
  export const NULL_COLOR: Color = [204, 204, 204];
package/src/utils.ts CHANGED
@@ -22,6 +22,14 @@ export function createBinaryProxy(
22
22
 
23
23
  has(target, property) {
24
24
  return property in numericProps || property in target;
25
+ },
26
+
27
+ ownKeys(target) {
28
+ return [...Object.keys(numericProps), ...Reflect.ownKeys(target)];
29
+ },
30
+
31
+ getOwnPropertyDescriptor(target, prop) {
32
+ return {enumerable: true, configurable: true};
25
33
  }
26
34
  });
27
35
  }