@carto/api-client 0.4.6 → 0.4.7-0
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/build/api-client.cjs +3473 -1556
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +1389 -0
- package/build/api-client.d.ts +1389 -0
- package/build/api-client.js +3676 -0
- package/build/api-client.js.map +1 -0
- package/build/worker.d.ts +2 -0
- package/build/worker.js +1949 -0
- package/build/worker.js.map +1 -0
- package/package.json +58 -40
- package/src/api/carto-api-error.ts +1 -1
- package/src/api/query.ts +5 -5
- package/src/api/request-with-parameters.ts +6 -6
- package/src/client.ts +3 -3
- package/src/constants-internal.ts +5 -11
- package/src/constants.ts +28 -3
- package/src/deck/get-data-filter-extension-props.ts +146 -0
- package/src/deck/index.ts +1 -0
- package/src/filters/Filter.ts +179 -0
- package/src/filters/FilterTypes.ts +109 -0
- package/src/filters/geosjonFeatures.ts +32 -0
- package/src/filters/index.ts +6 -0
- package/src/filters/tileFeatures.ts +51 -0
- package/src/filters/tileFeaturesGeometries.ts +444 -0
- package/src/filters/tileFeaturesSpatialIndex.ts +119 -0
- package/src/filters.ts +4 -4
- package/src/geo.ts +12 -14
- package/src/global.d.ts +3 -8
- package/src/index.ts +7 -0
- package/src/models/common.ts +11 -9
- package/src/models/index.ts +1 -1
- package/src/models/model.ts +3 -4
- package/src/operations/aggregation.ts +154 -0
- package/src/operations/applySorting.ts +109 -0
- package/src/operations/groupBy.ts +59 -0
- package/src/operations/groupByDate.ts +98 -0
- package/src/operations/histogram.ts +66 -0
- package/src/operations/index.ts +6 -0
- package/src/operations/scatterPlot.ts +50 -0
- package/src/sources/base-source.ts +8 -8
- package/src/sources/boundary-query-source.ts +2 -2
- package/src/sources/boundary-table-source.ts +2 -2
- package/src/sources/h3-query-source.ts +7 -5
- package/src/sources/h3-table-source.ts +7 -5
- package/src/sources/h3-tileset-source.ts +20 -8
- package/src/sources/index.ts +26 -26
- package/src/sources/quadbin-query-source.ts +7 -5
- package/src/sources/quadbin-table-source.ts +7 -5
- package/src/sources/quadbin-tileset-source.ts +20 -8
- package/src/sources/raster-source.ts +3 -2
- package/src/sources/types.ts +9 -3
- package/src/sources/vector-query-source.ts +7 -5
- package/src/sources/vector-table-source.ts +7 -5
- package/src/sources/vector-tileset-source.ts +21 -8
- package/src/spatial-index.ts +4 -5
- package/src/types-internal.ts +11 -5
- package/src/types.ts +73 -15
- package/src/utils/dateUtils.ts +28 -0
- package/src/utils/getTileFormat.ts +9 -0
- package/src/utils/makeIntervalComplete.ts +17 -0
- package/src/utils/transformTileCoordsToWGS84.ts +77 -0
- package/src/utils/transformToTileCoords.ts +85 -0
- package/src/utils.ts +3 -3
- package/src/widget-sources/index.ts +3 -1
- package/src/widget-sources/types.ts +37 -25
- package/src/widget-sources/widget-query-source.ts +12 -5
- package/src/widget-sources/{widget-base-source.ts → widget-remote-source.ts} +55 -149
- package/src/widget-sources/widget-source.ts +145 -0
- package/src/widget-sources/widget-table-source.ts +12 -5
- package/src/widget-sources/widget-tileset-source-impl.ts +417 -0
- package/src/widget-sources/widget-tileset-source.ts +311 -0
- package/src/workers/constants.ts +13 -0
- package/src/workers/types.ts +19 -0
- package/src/workers/widget-tileset-worker.ts +40 -0
- package/build/api/carto-api-error.d.ts +0 -26
- package/build/api/endpoints.d.ts +0 -24
- package/build/api/index.d.ts +0 -5
- package/build/api/query.d.ts +0 -3
- package/build/api/request-with-parameters.d.ts +0 -10
- package/build/api-client.modern.js +0 -1742
- package/build/api-client.modern.js.map +0 -1
- package/build/client.d.ts +0 -14
- package/build/constants-internal.d.ts +0 -26
- package/build/constants.d.ts +0 -31
- package/build/filters.d.ts +0 -39
- package/build/geo.d.ts +0 -19
- package/build/index.d.ts +0 -11
- package/build/models/common.d.ts +0 -27
- package/build/models/index.d.ts +0 -3
- package/build/models/model.d.ts +0 -37
- package/build/sources/base-source.d.ts +0 -4
- package/build/sources/boundary-query-source.d.ts +0 -10
- package/build/sources/boundary-table-source.d.ts +0 -8
- package/build/sources/h3-query-source.d.ts +0 -5
- package/build/sources/h3-table-source.d.ts +0 -5
- package/build/sources/h3-tileset-source.d.ts +0 -4
- package/build/sources/index.d.ts +0 -26
- package/build/sources/quadbin-query-source.d.ts +0 -5
- package/build/sources/quadbin-table-source.d.ts +0 -5
- package/build/sources/quadbin-tileset-source.d.ts +0 -4
- package/build/sources/raster-source.d.ts +0 -4
- package/build/sources/types.d.ts +0 -366
- package/build/sources/vector-query-source.d.ts +0 -5
- package/build/sources/vector-table-source.d.ts +0 -5
- package/build/sources/vector-tileset-source.d.ts +0 -4
- package/build/spatial-index.d.ts +0 -14
- package/build/types-internal.d.ts +0 -52
- package/build/types.d.ts +0 -80
- package/build/utils.d.ts +0 -32
- package/build/widget-sources/index.d.ts +0 -4
- package/build/widget-sources/types.d.ts +0 -149
- package/build/widget-sources/widget-base-source.d.ts +0 -99
- package/build/widget-sources/widget-query-source.d.ts +0 -33
- package/build/widget-sources/widget-table-source.d.ts +0 -33
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {baseSource} from './base-source';
|
|
6
|
-
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
5
|
+
import {baseSource} from './base-source.js';
|
|
6
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types.js';
|
|
7
7
|
|
|
8
8
|
export type BoundaryTableSourceOptions = SourceOptions &
|
|
9
9
|
FilterOptions & {
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetQuerySource,
|
|
8
|
+
WidgetQuerySourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
9
11
|
import type {
|
|
10
12
|
AggregationOptions,
|
|
11
13
|
FilterOptions,
|
|
@@ -13,7 +15,7 @@ import type {
|
|
|
13
15
|
SourceOptions,
|
|
14
16
|
SpatialDataType,
|
|
15
17
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
18
|
+
} from './types.js';
|
|
17
19
|
|
|
18
20
|
export type H3QuerySourceOptions = SourceOptions &
|
|
19
21
|
QuerySourceOptions &
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetTableSource,
|
|
8
|
+
WidgetTableSourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
9
11
|
import type {
|
|
10
12
|
AggregationOptions,
|
|
11
13
|
FilterOptions,
|
|
@@ -13,7 +15,7 @@ import type {
|
|
|
13
15
|
SpatialDataType,
|
|
14
16
|
TableSourceOptions,
|
|
15
17
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
18
|
+
} from './types.js';
|
|
17
19
|
|
|
18
20
|
export type H3TableSourceOptions = SourceOptions &
|
|
19
21
|
TableSourceOptions &
|
|
@@ -2,27 +2,39 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetTilesetSource,
|
|
8
|
+
WidgetTilesetSourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
6
11
|
import type {
|
|
7
12
|
SourceOptions,
|
|
8
13
|
TilejsonResult,
|
|
9
14
|
TilesetSourceOptions,
|
|
10
|
-
} from './types';
|
|
15
|
+
} from './types.js';
|
|
11
16
|
|
|
12
17
|
export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
13
18
|
type UrlParameters = {name: string};
|
|
14
19
|
|
|
15
|
-
export type H3TilesetSourceResponse = TilejsonResult
|
|
20
|
+
export type H3TilesetSourceResponse = TilejsonResult &
|
|
21
|
+
WidgetTilesetSourceResult;
|
|
16
22
|
|
|
17
23
|
export const h3TilesetSource = async function (
|
|
18
24
|
options: H3TilesetSourceOptions
|
|
19
25
|
): Promise<H3TilesetSourceResponse> {
|
|
20
|
-
const {tableName} = options;
|
|
26
|
+
const {tableName, spatialDataColumn = 'h3'} = options;
|
|
21
27
|
const urlParameters: UrlParameters = {name: tableName};
|
|
22
28
|
|
|
23
|
-
return baseSource<UrlParameters>(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
return baseSource<UrlParameters>('tileset', options, urlParameters).then(
|
|
30
|
+
(result) => ({
|
|
31
|
+
...(result as TilejsonResult),
|
|
32
|
+
widgetSource: new WidgetTilesetSource({
|
|
33
|
+
...options,
|
|
34
|
+
tileFormat: getTileFormat(result as TilejsonResult),
|
|
35
|
+
spatialDataColumn,
|
|
36
|
+
spatialDataType: 'h3',
|
|
37
|
+
}),
|
|
38
|
+
})
|
|
27
39
|
) as Promise<H3TilesetSourceResponse>;
|
|
28
40
|
};
|
package/src/sources/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
export {SOURCE_DEFAULTS} from './base-source';
|
|
5
|
+
export {SOURCE_DEFAULTS} from './base-source.js';
|
|
6
6
|
export type {
|
|
7
7
|
GeojsonResult,
|
|
8
8
|
JsonResult,
|
|
@@ -19,73 +19,73 @@ export type {
|
|
|
19
19
|
TileResolution,
|
|
20
20
|
TilesetSourceOptions,
|
|
21
21
|
VectorLayer,
|
|
22
|
-
} from './types';
|
|
22
|
+
} from './types.js';
|
|
23
23
|
|
|
24
|
-
export {boundaryQuerySource} from './boundary-query-source';
|
|
24
|
+
export {boundaryQuerySource} from './boundary-query-source.js';
|
|
25
25
|
export type {
|
|
26
26
|
BoundaryQuerySourceOptions,
|
|
27
27
|
BoundaryQuerySourceResponse,
|
|
28
|
-
} from './boundary-query-source';
|
|
28
|
+
} from './boundary-query-source.js';
|
|
29
29
|
|
|
30
|
-
export {boundaryTableSource} from './boundary-table-source';
|
|
30
|
+
export {boundaryTableSource} from './boundary-table-source.js';
|
|
31
31
|
export type {
|
|
32
32
|
BoundaryTableSourceOptions,
|
|
33
33
|
BoundaryTableSourceResponse,
|
|
34
|
-
} from './boundary-table-source';
|
|
34
|
+
} from './boundary-table-source.js';
|
|
35
35
|
|
|
36
|
-
export {h3QuerySource} from './h3-query-source';
|
|
36
|
+
export {h3QuerySource} from './h3-query-source.js';
|
|
37
37
|
export type {
|
|
38
38
|
H3QuerySourceOptions,
|
|
39
39
|
H3QuerySourceResponse,
|
|
40
|
-
} from './h3-query-source';
|
|
40
|
+
} from './h3-query-source.js';
|
|
41
41
|
|
|
42
|
-
export {h3TableSource} from './h3-table-source';
|
|
42
|
+
export {h3TableSource} from './h3-table-source.js';
|
|
43
43
|
export type {
|
|
44
44
|
H3TableSourceOptions,
|
|
45
45
|
H3TableSourceResponse,
|
|
46
|
-
} from './h3-table-source';
|
|
46
|
+
} from './h3-table-source.js';
|
|
47
47
|
|
|
48
|
-
export {h3TilesetSource} from './h3-tileset-source';
|
|
48
|
+
export {h3TilesetSource} from './h3-tileset-source.js';
|
|
49
49
|
export type {
|
|
50
50
|
H3TilesetSourceOptions,
|
|
51
51
|
H3TilesetSourceResponse,
|
|
52
|
-
} from './h3-tileset-source';
|
|
52
|
+
} from './h3-tileset-source.js';
|
|
53
53
|
|
|
54
|
-
export {rasterSource} from './raster-source';
|
|
55
|
-
export type {RasterSourceOptions
|
|
54
|
+
export {rasterSource} from './raster-source.js';
|
|
55
|
+
export type {RasterSourceOptions} from './raster-source.js';
|
|
56
56
|
|
|
57
|
-
export {quadbinQuerySource} from './quadbin-query-source';
|
|
57
|
+
export {quadbinQuerySource} from './quadbin-query-source.js';
|
|
58
58
|
export type {
|
|
59
59
|
QuadbinQuerySourceOptions,
|
|
60
60
|
QuadbinQuerySourceResponse,
|
|
61
|
-
} from './quadbin-query-source';
|
|
61
|
+
} from './quadbin-query-source.js';
|
|
62
62
|
|
|
63
|
-
export {quadbinTableSource} from './quadbin-table-source';
|
|
63
|
+
export {quadbinTableSource} from './quadbin-table-source.js';
|
|
64
64
|
export type {
|
|
65
65
|
QuadbinTableSourceOptions,
|
|
66
66
|
QuadbinTableSourceResponse,
|
|
67
|
-
} from './quadbin-table-source';
|
|
67
|
+
} from './quadbin-table-source.js';
|
|
68
68
|
|
|
69
|
-
export {quadbinTilesetSource} from './quadbin-tileset-source';
|
|
69
|
+
export {quadbinTilesetSource} from './quadbin-tileset-source.js';
|
|
70
70
|
export type {
|
|
71
71
|
QuadbinTilesetSourceOptions,
|
|
72
72
|
QuadbinTilesetSourceResponse,
|
|
73
|
-
} from './quadbin-tileset-source';
|
|
73
|
+
} from './quadbin-tileset-source.js';
|
|
74
74
|
|
|
75
|
-
export {vectorQuerySource} from './vector-query-source';
|
|
75
|
+
export {vectorQuerySource} from './vector-query-source.js';
|
|
76
76
|
export type {
|
|
77
77
|
VectorQuerySourceOptions,
|
|
78
78
|
VectorQuerySourceResponse,
|
|
79
|
-
} from './vector-query-source';
|
|
79
|
+
} from './vector-query-source.js';
|
|
80
80
|
|
|
81
|
-
export {vectorTableSource} from './vector-table-source';
|
|
81
|
+
export {vectorTableSource} from './vector-table-source.js';
|
|
82
82
|
export type {
|
|
83
83
|
VectorTableSourceOptions,
|
|
84
84
|
VectorTableSourceResponse,
|
|
85
|
-
} from './vector-table-source';
|
|
85
|
+
} from './vector-table-source.js';
|
|
86
86
|
|
|
87
|
-
export {vectorTilesetSource} from './vector-tileset-source';
|
|
87
|
+
export {vectorTilesetSource} from './vector-tileset-source.js';
|
|
88
88
|
export type {
|
|
89
89
|
VectorTilesetSourceOptions,
|
|
90
90
|
VectorTilesetSourceResponse,
|
|
91
|
-
} from './vector-tileset-source';
|
|
91
|
+
} from './vector-tileset-source.js';
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetQuerySource,
|
|
8
|
+
WidgetQuerySourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
9
11
|
import type {
|
|
10
12
|
AggregationOptions,
|
|
11
13
|
FilterOptions,
|
|
@@ -13,7 +15,7 @@ import type {
|
|
|
13
15
|
SourceOptions,
|
|
14
16
|
SpatialDataType,
|
|
15
17
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
18
|
+
} from './types.js';
|
|
17
19
|
|
|
18
20
|
export type QuadbinQuerySourceOptions = SourceOptions &
|
|
19
21
|
QuerySourceOptions &
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetTableSource,
|
|
8
|
+
WidgetTableSourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
9
11
|
import type {
|
|
10
12
|
AggregationOptions,
|
|
11
13
|
FilterOptions,
|
|
@@ -13,7 +15,7 @@ import type {
|
|
|
13
15
|
SpatialDataType,
|
|
14
16
|
TableSourceOptions,
|
|
15
17
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
18
|
+
} from './types.js';
|
|
17
19
|
|
|
18
20
|
export type QuadbinTableSourceOptions = SourceOptions &
|
|
19
21
|
TableSourceOptions &
|
|
@@ -2,27 +2,39 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
6
|
+
import {
|
|
7
|
+
WidgetTilesetSource,
|
|
8
|
+
WidgetTilesetSourceResult,
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
6
11
|
import type {
|
|
7
12
|
SourceOptions,
|
|
8
13
|
TilejsonResult,
|
|
9
14
|
TilesetSourceOptions,
|
|
10
|
-
} from './types';
|
|
15
|
+
} from './types.js';
|
|
11
16
|
|
|
12
17
|
export type QuadbinTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
13
18
|
type UrlParameters = {name: string};
|
|
14
19
|
|
|
15
|
-
export type QuadbinTilesetSourceResponse = TilejsonResult
|
|
20
|
+
export type QuadbinTilesetSourceResponse = TilejsonResult &
|
|
21
|
+
WidgetTilesetSourceResult;
|
|
16
22
|
|
|
17
23
|
export const quadbinTilesetSource = async function (
|
|
18
24
|
options: QuadbinTilesetSourceOptions
|
|
19
25
|
): Promise<QuadbinTilesetSourceResponse> {
|
|
20
|
-
const {tableName} = options;
|
|
26
|
+
const {tableName, spatialDataColumn = 'quadbin'} = options;
|
|
21
27
|
const urlParameters: UrlParameters = {name: tableName};
|
|
22
28
|
|
|
23
|
-
return baseSource<UrlParameters>(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
return baseSource<UrlParameters>('tileset', options, urlParameters).then(
|
|
30
|
+
(result) => ({
|
|
31
|
+
...(result as TilejsonResult),
|
|
32
|
+
widgetSource: new WidgetTilesetSource({
|
|
33
|
+
...options,
|
|
34
|
+
tileFormat: getTileFormat(result as TilejsonResult),
|
|
35
|
+
spatialDataColumn,
|
|
36
|
+
spatialDataType: 'quadbin',
|
|
37
|
+
}),
|
|
38
|
+
})
|
|
27
39
|
) as Promise<QuadbinTilesetSourceResponse>;
|
|
28
40
|
};
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {baseSource} from './base-source';
|
|
5
|
+
import {baseSource} from './base-source.js';
|
|
6
6
|
import type {
|
|
7
7
|
FilterOptions,
|
|
8
8
|
SourceOptions,
|
|
9
9
|
TilejsonResult,
|
|
10
10
|
TilesetSourceOptions,
|
|
11
|
-
} from './types';
|
|
11
|
+
} from './types.js';
|
|
12
12
|
|
|
13
13
|
export type RasterSourceOptions = SourceOptions &
|
|
14
14
|
TilesetSourceOptions &
|
|
@@ -28,6 +28,7 @@ export const rasterSource = async function (
|
|
|
28
28
|
if (filters) {
|
|
29
29
|
urlParameters.filters = filters;
|
|
30
30
|
}
|
|
31
|
+
|
|
31
32
|
return baseSource<UrlParameters>(
|
|
32
33
|
'raster',
|
|
33
34
|
options,
|
package/src/sources/types.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import type {Feature} from 'geojson';
|
|
6
|
-
import {Filters, Format, QueryParameters} from '../types';
|
|
7
|
-
import {MapInstantiation} from '../types-internal';
|
|
6
|
+
import {Filters, Format, QueryParameters} from '../types.js';
|
|
7
|
+
import {MapInstantiation} from '../types-internal.js';
|
|
8
8
|
|
|
9
9
|
export type SourceRequiredOptions = {
|
|
10
10
|
/** Carto platform access token. */
|
|
@@ -191,6 +191,12 @@ export type TilesetSourceOptions = {
|
|
|
191
191
|
* Fully qualified name of tileset.
|
|
192
192
|
*/
|
|
193
193
|
tableName: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Whether to use Web Workers for local widget calculations. Workers
|
|
197
|
+
* are used by default if the runtime environment supports ES Module Workers.
|
|
198
|
+
*/
|
|
199
|
+
widgetWorker?: boolean;
|
|
194
200
|
};
|
|
195
201
|
|
|
196
202
|
export type ColumnsOption = {
|
|
@@ -208,7 +214,7 @@ export type SpatialDataType = 'geo' | 'h3' | 'quadbin';
|
|
|
208
214
|
* Strategy used for covering spatial filter geometry with spatial indexes.
|
|
209
215
|
* See https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/quadbin#quadbin_polyfill_mode
|
|
210
216
|
* or https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/h3#h3_polyfill_mode for more information.
|
|
211
|
-
* @
|
|
217
|
+
* @privateRemarks Source: cloud-native maps-api
|
|
212
218
|
* */
|
|
213
219
|
export type SpatialFilterPolyfillMode = 'center' | 'intersects' | 'contains';
|
|
214
220
|
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_GEO_COLUMN,
|
|
7
|
+
DEFAULT_TILE_RESOLUTION,
|
|
8
|
+
} from '../constants-internal.js';
|
|
7
9
|
import {
|
|
8
10
|
WidgetQuerySource,
|
|
9
11
|
WidgetQuerySourceResult,
|
|
10
12
|
} from '../widget-sources/index.js';
|
|
11
|
-
import {baseSource} from './base-source';
|
|
13
|
+
import {baseSource} from './base-source.js';
|
|
12
14
|
import type {
|
|
13
15
|
FilterOptions,
|
|
14
16
|
SourceOptions,
|
|
@@ -16,7 +18,7 @@ import type {
|
|
|
16
18
|
SpatialDataType,
|
|
17
19
|
TilejsonResult,
|
|
18
20
|
ColumnsOption,
|
|
19
|
-
} from './types';
|
|
21
|
+
} from './types.js';
|
|
20
22
|
|
|
21
23
|
export type VectorQuerySourceOptions = SourceOptions &
|
|
22
24
|
QuerySourceOptions &
|
|
@@ -43,7 +45,7 @@ export const vectorQuerySource = async function (
|
|
|
43
45
|
const {
|
|
44
46
|
columns,
|
|
45
47
|
filters,
|
|
46
|
-
spatialDataColumn =
|
|
48
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
47
49
|
sqlQuery,
|
|
48
50
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
49
51
|
queryParameters,
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_GEO_COLUMN,
|
|
7
|
+
DEFAULT_TILE_RESOLUTION,
|
|
8
|
+
} from '../constants-internal.js';
|
|
7
9
|
import {
|
|
8
10
|
WidgetTableSource,
|
|
9
11
|
WidgetTableSourceResult,
|
|
10
12
|
} from '../widget-sources/index.js';
|
|
11
|
-
import {baseSource} from './base-source';
|
|
13
|
+
import {baseSource} from './base-source.js';
|
|
12
14
|
import type {
|
|
13
15
|
FilterOptions,
|
|
14
16
|
ColumnsOption,
|
|
@@ -16,7 +18,7 @@ import type {
|
|
|
16
18
|
SpatialDataType,
|
|
17
19
|
TableSourceOptions,
|
|
18
20
|
TilejsonResult,
|
|
19
|
-
} from './types';
|
|
21
|
+
} from './types.js';
|
|
20
22
|
|
|
21
23
|
export type VectorTableSourceOptions = SourceOptions &
|
|
22
24
|
TableSourceOptions &
|
|
@@ -42,7 +44,7 @@ export const vectorTableSource = async function (
|
|
|
42
44
|
const {
|
|
43
45
|
columns,
|
|
44
46
|
filters,
|
|
45
|
-
spatialDataColumn =
|
|
47
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
46
48
|
tableName,
|
|
47
49
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
48
50
|
aggregationExp,
|
|
@@ -2,27 +2,40 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {DEFAULT_GEO_COLUMN} from '../constants-internal.js';
|
|
6
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
7
|
+
import {
|
|
8
|
+
WidgetTilesetSource,
|
|
9
|
+
WidgetTilesetSourceResult,
|
|
10
|
+
} from '../widget-sources/index.js';
|
|
11
|
+
import {baseSource} from './base-source.js';
|
|
6
12
|
import type {
|
|
7
13
|
SourceOptions,
|
|
8
14
|
TilesetSourceOptions,
|
|
9
15
|
TilejsonResult,
|
|
10
|
-
} from './types';
|
|
16
|
+
} from './types.js';
|
|
11
17
|
|
|
12
18
|
export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
13
19
|
type UrlParameters = {name: string};
|
|
14
20
|
|
|
15
|
-
export type VectorTilesetSourceResponse = TilejsonResult
|
|
21
|
+
export type VectorTilesetSourceResponse = TilejsonResult &
|
|
22
|
+
WidgetTilesetSourceResult;
|
|
16
23
|
|
|
17
24
|
export const vectorTilesetSource = async function (
|
|
18
25
|
options: VectorTilesetSourceOptions
|
|
19
26
|
): Promise<VectorTilesetSourceResponse> {
|
|
20
|
-
const {tableName} = options;
|
|
27
|
+
const {tableName, spatialDataColumn = DEFAULT_GEO_COLUMN} = options;
|
|
21
28
|
const urlParameters: UrlParameters = {name: tableName};
|
|
22
29
|
|
|
23
|
-
return baseSource<UrlParameters>(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
return baseSource<UrlParameters>('tileset', options, urlParameters).then(
|
|
31
|
+
(result) => ({
|
|
32
|
+
...(result as TilejsonResult),
|
|
33
|
+
widgetSource: new WidgetTilesetSource({
|
|
34
|
+
...options,
|
|
35
|
+
tileFormat: getTileFormat(result as TilejsonResult),
|
|
36
|
+
spatialDataColumn,
|
|
37
|
+
spatialDataType: 'geo',
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
27
40
|
) as Promise<VectorTilesetSourceResponse>;
|
|
28
41
|
};
|
package/src/spatial-index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
3
3
|
DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
4
|
-
} from './constants-internal';
|
|
5
|
-
import type {ModelSource} from './models/model';
|
|
6
|
-
import type {AggregationOptions} from './sources/types';
|
|
7
|
-
import {
|
|
8
|
-
import type {ViewState} from './widget-sources';
|
|
4
|
+
} from './constants-internal.js';
|
|
5
|
+
import type {ModelSource} from './models/model.js';
|
|
6
|
+
import type {AggregationOptions} from './sources/types.js';
|
|
7
|
+
import type {ViewState} from './widget-sources/index.js';
|
|
9
8
|
|
|
10
9
|
const DEFAULT_TILE_SIZE = 512;
|
|
11
10
|
const QUADBIN_ZOOM_MAX_OFFSET = 4;
|
package/src/types-internal.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* COMMON
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {Format} from './types';
|
|
5
|
+
import {Format} from './types.js';
|
|
6
6
|
|
|
7
7
|
/** @internal */
|
|
8
8
|
export type $TODO = any;
|
|
@@ -15,7 +15,7 @@ export type $IntentionalAny = any;
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @
|
|
18
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
21
|
export enum SchemaFieldType {
|
|
@@ -31,7 +31,7 @@ export enum SchemaFieldType {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @
|
|
34
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
35
35
|
* @internal
|
|
36
36
|
*/
|
|
37
37
|
export interface SchemaField {
|
|
@@ -40,7 +40,7 @@ export interface SchemaField {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* @
|
|
43
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
46
46
|
export interface MapInstantiation extends MapInstantiationFormats {
|
|
@@ -50,7 +50,7 @@ export interface MapInstantiation extends MapInstantiationFormats {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* @
|
|
53
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
56
|
type MapInstantiationFormats = Record<
|
|
@@ -60,3 +60,9 @@ type MapInstantiationFormats = Record<
|
|
|
60
60
|
error?: any;
|
|
61
61
|
}
|
|
62
62
|
>;
|
|
63
|
+
|
|
64
|
+
/******************************************************************************
|
|
65
|
+
* LOCAL CALCULATIONS
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export type FeatureData = Record<string, unknown>;
|