@carto/api-client 0.5.0-alpha.1 → 0.5.0-alpha.11
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/CHANGELOG.md +4 -0
- package/build/api-client.cjs +3163 -3206
- 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 +3674 -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 +60 -45
- 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 +6 -6
- package/src/deck/get-data-filter-extension-props.ts +146 -0
- package/src/deck/index.ts +1 -0
- package/src/filters/Filter.ts +18 -8
- package/src/filters/FilterTypes.ts +2 -2
- package/src/filters/geosjonFeatures.ts +2 -2
- package/src/filters/tileFeatures.ts +12 -17
- package/src/filters.ts +4 -4
- package/src/geo.ts +12 -14
- package/src/global.d.ts +3 -8
- package/src/index.ts +3 -0
- package/src/models/common.ts +11 -9
- package/src/models/model.ts +3 -4
- package/src/operations/aggregation.ts +5 -5
- package/src/operations/applySorting.ts +4 -4
- package/src/operations/groupBy.ts +4 -4
- package/src/operations/groupByDate.ts +1 -1
- package/src/operations/histogram.ts +4 -4
- package/src/operations/scatterPlot.ts +4 -4
- 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 +4 -4
- 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 +4 -4
- package/src/sources/raster-source.ts +2 -2
- package/src/sources/types.ts +9 -3
- package/src/sources/vector-query-source.ts +2 -3
- package/src/sources/vector-table-source.ts +2 -3
- package/src/sources/vector-tileset-source.ts +5 -5
- package/src/spatial-index.ts +12 -10
- package/src/types-internal.ts +5 -5
- package/src/types.ts +15 -15
- package/src/utils/makeIntervalComplete.ts +1 -1
- package/src/utils.ts +3 -3
- package/src/widget-sources/index.ts +1 -0
- package/src/widget-sources/types.ts +6 -4
- package/src/widget-sources/widget-query-source.ts +6 -2
- package/src/widget-sources/widget-remote-source.ts +67 -26
- package/src/widget-sources/widget-source.ts +10 -25
- package/src/widget-sources/widget-table-source.ts +6 -2
- package/src/widget-sources/widget-tileset-source-impl.ts +417 -0
- package/src/widget-sources/widget-tileset-source.ts +200 -299
- 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 -3574
- 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 -53
- package/build/filters/Filter.d.ts +0 -13
- package/build/filters/FilterTypes.d.ts +0 -3
- package/build/filters/geosjonFeatures.d.ts +0 -8
- package/build/filters/index.d.ts +0 -6
- package/build/filters/tileFeatures.d.ts +0 -20
- package/build/filters/tileFeaturesGeometries.d.ts +0 -13
- package/build/filters/tileFeaturesSpatialIndex.d.ts +0 -10
- package/build/filters.d.ts +0 -39
- package/build/geo.d.ts +0 -19
- package/build/index.d.ts +0 -14
- 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/operations/aggregation.d.ts +0 -8
- package/build/operations/applySorting.d.ts +0 -20
- package/build/operations/groupBy.d.ts +0 -15
- package/build/operations/groupByDate.d.ts +0 -11
- package/build/operations/histogram.d.ts +0 -13
- package/build/operations/index.d.ts +0 -6
- package/build/operations/scatterPlot.d.ts +0 -14
- 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 -5
- 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 -5
- 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 -5
- package/build/spatial-index.d.ts +0 -8
- package/build/types-internal.d.ts +0 -56
- package/build/types.d.ts +0 -140
- package/build/utils/dateUtils.d.ts +0 -10
- package/build/utils/getTileFormat.d.ts +0 -3
- package/build/utils/makeIntervalComplete.d.ts +0 -2
- package/build/utils/transformTileCoordsToWGS84.d.ts +0 -8
- package/build/utils/transformToTileCoords.d.ts +0 -9
- package/build/utils.d.ts +0 -32
- package/build/widget-sources/index.d.ts +0 -5
- package/build/widget-sources/types.d.ts +0 -158
- package/build/widget-sources/widget-query-source.d.ts +0 -33
- package/build/widget-sources/widget-remote-source.d.ts +0 -18
- package/build/widget-sources/widget-source.d.ts +0 -74
- package/build/widget-sources/widget-table-source.d.ts +0 -33
- package/build/widget-sources/widget-tileset-source.d.ts +0 -76
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {firstBy} from 'thenby';
|
|
2
|
-
import {SortDirection} from '../types';
|
|
3
|
-
import {FeatureData} from '../types-internal';
|
|
2
|
+
import {SortDirection} from '../types.js';
|
|
3
|
+
import {FeatureData} from '../types-internal.js';
|
|
4
4
|
|
|
5
5
|
// TODO(cleanup): Could this be simplified?
|
|
6
6
|
type SortColumns = string | string[] | object[];
|
|
@@ -19,7 +19,7 @@ interface SortOptions {
|
|
|
19
19
|
* @param [sortOptions.sortByDirection] - Direction by the columns will be sorted
|
|
20
20
|
* @param [sortOptions.sortByColumnType] - Column type
|
|
21
21
|
* @internal
|
|
22
|
-
* @
|
|
22
|
+
* @privateRemarks Source: @carto/react-core
|
|
23
23
|
*/
|
|
24
24
|
export function applySorting(
|
|
25
25
|
features: FeatureData[],
|
|
@@ -63,7 +63,7 @@ function createSortFn({
|
|
|
63
63
|
}) as Parameters<typeof firstBy>[];
|
|
64
64
|
|
|
65
65
|
let sortFn = firstBy(...firstSortOption);
|
|
66
|
-
for (
|
|
66
|
+
for (const sortOptions of othersSortOptions) {
|
|
67
67
|
sortFn = sortFn.thenBy(...sortOptions);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {aggregationFunctions, aggregate} from './aggregation.js';
|
|
2
|
-
import {AggregationType} from '../types';
|
|
3
|
-
import {FeatureData} from '../types-internal';
|
|
2
|
+
import {AggregationType} from '../types.js';
|
|
3
|
+
import {FeatureData} from '../types-internal.js';
|
|
4
4
|
|
|
5
|
-
/** @
|
|
5
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
6
6
|
export type GroupByFeature = {
|
|
7
7
|
name: string;
|
|
8
8
|
value: number;
|
|
9
9
|
}[];
|
|
10
10
|
|
|
11
|
-
/** @
|
|
11
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
12
12
|
export function groupValuesByColumn({
|
|
13
13
|
data,
|
|
14
14
|
valuesColumns,
|
|
@@ -35,7 +35,7 @@ const GROUP_KEY_FN_MAPPING: Record<GroupDateType, (date: Date) => number> = {
|
|
|
35
35
|
),
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
/** @
|
|
38
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
39
39
|
export function groupValuesByDateColumn({
|
|
40
40
|
data,
|
|
41
41
|
valuesColumns,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {aggregate, aggregationFunctions} from './aggregation';
|
|
2
|
-
import {AggregationType} from '../types';
|
|
3
|
-
import {FeatureData} from '../types-internal';
|
|
1
|
+
import {aggregate, aggregationFunctions} from './aggregation.js';
|
|
2
|
+
import {AggregationType} from '../types.js';
|
|
3
|
+
import {FeatureData} from '../types-internal.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Histogram computation.
|
|
7
|
-
* @
|
|
7
|
+
* @privateRemarks Source: @carto/react-core
|
|
8
8
|
*/
|
|
9
9
|
export function histogram({
|
|
10
10
|
data,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {aggregate} from './aggregation';
|
|
2
|
-
import {FeatureData} from '../types-internal';
|
|
3
|
-
import {AggregationType} from '../types';
|
|
1
|
+
import {aggregate} from './aggregation.js';
|
|
2
|
+
import {FeatureData} from '../types-internal.js';
|
|
3
|
+
import {AggregationType} from '../types.js';
|
|
4
4
|
|
|
5
5
|
export type ScatterPlotFeature = [number, number][];
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Filters invalid features and formats data.
|
|
9
|
-
* @
|
|
9
|
+
* @privateRemarks Source: @carto/react-core
|
|
10
10
|
*/
|
|
11
11
|
export function scatterPlot({
|
|
12
12
|
data,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {DEFAULT_API_BASE_URL} from '../constants';
|
|
6
|
-
import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal';
|
|
7
|
-
import {buildSourceUrl} from '../api/endpoints';
|
|
8
|
-
import {requestWithParameters} from '../api/request-with-parameters';
|
|
5
|
+
import {DEFAULT_API_BASE_URL} from '../constants.js';
|
|
6
|
+
import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal.js';
|
|
7
|
+
import {buildSourceUrl} from '../api/endpoints.js';
|
|
8
|
+
import {requestWithParameters} from '../api/request-with-parameters.js';
|
|
9
9
|
import type {
|
|
10
10
|
GeojsonResult,
|
|
11
11
|
JsonResult,
|
|
@@ -13,10 +13,10 @@ import type {
|
|
|
13
13
|
SourceRequiredOptions,
|
|
14
14
|
TilejsonMapInstantiation,
|
|
15
15
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
17
|
-
import {MapType} from '../types';
|
|
18
|
-
import {APIErrorContext} from '../api';
|
|
19
|
-
import {getClient} from '../client';
|
|
16
|
+
} from './types.js';
|
|
17
|
+
import {MapType} from '../types.js';
|
|
18
|
+
import {APIErrorContext} from '../api/index.js';
|
|
19
|
+
import {getClient} from '../client.js';
|
|
20
20
|
|
|
21
21
|
export const SOURCE_DEFAULTS: SourceOptionalOptions = {
|
|
22
22
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {QueryParameters} from '../types.js';
|
|
6
|
-
import {baseSource} from './base-source';
|
|
7
|
-
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
6
|
+
import {baseSource} from './base-source.js';
|
|
7
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types.js';
|
|
8
8
|
|
|
9
9
|
export type BoundaryQuerySourceOptions = SourceOptions &
|
|
10
10
|
FilterOptions & {
|
|
@@ -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,17 +2,17 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {getTileFormat} from '../utils/getTileFormat';
|
|
5
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
6
6
|
import {
|
|
7
7
|
WidgetTilesetSource,
|
|
8
8
|
WidgetTilesetSourceResult,
|
|
9
|
-
} from '../widget-sources';
|
|
10
|
-
import {baseSource} from './base-source';
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
11
11
|
import type {
|
|
12
12
|
SourceOptions,
|
|
13
13
|
TilejsonResult,
|
|
14
14
|
TilesetSourceOptions,
|
|
15
|
-
} from './types';
|
|
15
|
+
} from './types.js';
|
|
16
16
|
|
|
17
17
|
export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
18
18
|
type UrlParameters = {name: string};
|
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} from './raster-source';
|
|
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,17 +2,17 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {getTileFormat} from '../utils/getTileFormat';
|
|
5
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
6
6
|
import {
|
|
7
7
|
WidgetTilesetSource,
|
|
8
8
|
WidgetTilesetSourceResult,
|
|
9
|
-
} from '../widget-sources';
|
|
10
|
-
import {baseSource} from './base-source';
|
|
9
|
+
} from '../widget-sources/index.js';
|
|
10
|
+
import {baseSource} from './base-source.js';
|
|
11
11
|
import type {
|
|
12
12
|
SourceOptions,
|
|
13
13
|
TilejsonResult,
|
|
14
14
|
TilesetSourceOptions,
|
|
15
|
-
} from './types';
|
|
15
|
+
} from './types.js';
|
|
16
16
|
|
|
17
17
|
export type QuadbinTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
18
18
|
type UrlParameters = {name: string};
|
|
@@ -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 &
|
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,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
/* eslint-disable camelcase */
|
|
6
5
|
import {
|
|
7
6
|
DEFAULT_GEO_COLUMN,
|
|
8
7
|
DEFAULT_TILE_RESOLUTION,
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
WidgetQuerySource,
|
|
12
11
|
WidgetQuerySourceResult,
|
|
13
12
|
} from '../widget-sources/index.js';
|
|
14
|
-
import {baseSource} from './base-source';
|
|
13
|
+
import {baseSource} from './base-source.js';
|
|
15
14
|
import type {
|
|
16
15
|
FilterOptions,
|
|
17
16
|
SourceOptions,
|
|
@@ -19,7 +18,7 @@ import type {
|
|
|
19
18
|
SpatialDataType,
|
|
20
19
|
TilejsonResult,
|
|
21
20
|
ColumnsOption,
|
|
22
|
-
} from './types';
|
|
21
|
+
} from './types.js';
|
|
23
22
|
|
|
24
23
|
export type VectorQuerySourceOptions = SourceOptions &
|
|
25
24
|
QuerySourceOptions &
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
/* eslint-disable camelcase */
|
|
6
5
|
import {
|
|
7
6
|
DEFAULT_GEO_COLUMN,
|
|
8
7
|
DEFAULT_TILE_RESOLUTION,
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
WidgetTableSource,
|
|
12
11
|
WidgetTableSourceResult,
|
|
13
12
|
} from '../widget-sources/index.js';
|
|
14
|
-
import {baseSource} from './base-source';
|
|
13
|
+
import {baseSource} from './base-source.js';
|
|
15
14
|
import type {
|
|
16
15
|
FilterOptions,
|
|
17
16
|
ColumnsOption,
|
|
@@ -19,7 +18,7 @@ import type {
|
|
|
19
18
|
SpatialDataType,
|
|
20
19
|
TableSourceOptions,
|
|
21
20
|
TilejsonResult,
|
|
22
|
-
} from './types';
|
|
21
|
+
} from './types.js';
|
|
23
22
|
|
|
24
23
|
export type VectorTableSourceOptions = SourceOptions &
|
|
25
24
|
TableSourceOptions &
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {DEFAULT_GEO_COLUMN} from '../constants-internal';
|
|
6
|
-
import {getTileFormat} from '../utils/getTileFormat';
|
|
5
|
+
import {DEFAULT_GEO_COLUMN} from '../constants-internal.js';
|
|
6
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
7
7
|
import {
|
|
8
8
|
WidgetTilesetSource,
|
|
9
9
|
WidgetTilesetSourceResult,
|
|
10
|
-
} from '../widget-sources';
|
|
11
|
-
import {baseSource} from './base-source';
|
|
10
|
+
} from '../widget-sources/index.js';
|
|
11
|
+
import {baseSource} from './base-source.js';
|
|
12
12
|
import type {
|
|
13
13
|
SourceOptions,
|
|
14
14
|
TilesetSourceOptions,
|
|
15
15
|
TilejsonResult,
|
|
16
|
-
} from './types';
|
|
16
|
+
} from './types.js';
|
|
17
17
|
|
|
18
18
|
export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
19
19
|
type UrlParameters = {name: string};
|
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;
|
|
@@ -40,7 +39,7 @@ export function getSpatialFiltersResolution(
|
|
|
40
39
|
: dataResolution;
|
|
41
40
|
|
|
42
41
|
const hexagonResolution =
|
|
43
|
-
|
|
42
|
+
_getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
|
|
44
43
|
|
|
45
44
|
return Math.min(hexagonResolution, maxSpatialFiltersResolution);
|
|
46
45
|
}
|
|
@@ -88,10 +87,13 @@ const maxH3SpatialFiltersResolutions = [
|
|
|
88
87
|
// Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
|
|
89
88
|
const BIAS = 2;
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Resolution conversion function. Takes a WebMercatorViewport and returns
|
|
92
|
+
* a H3 resolution such that the screen space size of the hexagons is
|
|
93
|
+
* "similar" to the given tileSize on screen. Intended for use with deck.gl.
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
export function _getHexagonResolution(
|
|
95
97
|
viewport: {zoom: number; latitude: number},
|
|
96
98
|
tileSize: number
|
|
97
99
|
): number {
|
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<
|