@carto/api-client 0.5.0-alpha.2 → 0.5.0-alpha.4
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/carto-api-error.d.ts +1 -1
- package/build/api/query.d.ts +1 -1
- package/build/api/request-with-parameters.d.ts +2 -2
- package/build/api-client.cjs +2380 -2508
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +2220 -2349
- package/build/api-client.modern.js.map +1 -1
- package/build/client.d.ts +2 -2
- package/build/constants-internal.d.ts +5 -5
- package/build/constants.d.ts +6 -6
- package/build/deck/get-data-filter-extension-props.d.ts +18 -0
- package/build/deck/index.d.ts +1 -0
- package/build/filters/Filter.d.ts +15 -3
- package/build/filters/FilterTypes.d.ts +1 -1
- package/build/filters/geosjonFeatures.d.ts +2 -2
- package/build/filters/tileFeatures.d.ts +10 -9
- package/build/filters/tileFeaturesRaster.d.ts +16 -0
- package/build/filters.d.ts +2 -2
- package/build/geo.d.ts +1 -1
- package/build/index.d.ts +2 -0
- package/build/models/common.d.ts +4 -3
- package/build/models/model.d.ts +2 -2
- package/build/operations/aggregation.d.ts +5 -5
- package/build/operations/applySorting.d.ts +3 -3
- package/build/operations/groupBy.d.ts +4 -4
- package/build/operations/groupByDate.d.ts +1 -1
- package/build/operations/histogram.d.ts +3 -3
- package/build/operations/scatterPlot.d.ts +3 -3
- package/build/sources/base-source.d.ts +2 -2
- package/build/sources/boundary-query-source.d.ts +1 -1
- package/build/sources/boundary-table-source.d.ts +1 -1
- package/build/sources/h3-query-source.d.ts +2 -2
- package/build/sources/h3-table-source.d.ts +2 -2
- package/build/sources/h3-tileset-source.d.ts +2 -2
- package/build/sources/index.d.ts +26 -26
- package/build/sources/quadbin-query-source.d.ts +2 -2
- package/build/sources/quadbin-table-source.d.ts +2 -2
- package/build/sources/quadbin-tileset-source.d.ts +2 -2
- package/build/sources/raster-source.d.ts +3 -2
- package/build/sources/types.d.ts +4 -4
- package/build/sources/vector-query-source.d.ts +1 -1
- package/build/sources/vector-table-source.d.ts +1 -1
- package/build/sources/vector-tileset-source.d.ts +2 -2
- package/build/spatial-index.d.ts +10 -4
- package/build/types-internal.d.ts +5 -5
- package/build/types.d.ts +23 -15
- package/build/utils/makeIntervalComplete.d.ts +1 -1
- package/build/utils.d.ts +3 -3
- package/build/widget-sources/index.d.ts +1 -0
- package/build/widget-sources/types.d.ts +4 -2
- package/build/widget-sources/widget-query-source.d.ts +2 -1
- package/build/widget-sources/widget-raster-source.d.ts +11 -0
- package/build/widget-sources/widget-remote-source.d.ts +3 -0
- package/build/widget-sources/widget-source.d.ts +3 -3
- package/build/widget-sources/widget-table-source.d.ts +2 -1
- package/build/widget-sources/widget-tileset-source.d.ts +21 -22
- package/package.json +44 -32
- 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 -5
- 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 +33 -23
- package/src/filters/tileFeaturesRaster.ts +111 -0
- package/src/filters.ts +4 -4
- package/src/geo.ts +12 -14
- package/src/index.ts +3 -0
- package/src/models/common.ts +9 -7
- 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 +20 -7
- package/src/sources/types.ts +4 -4
- 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 +21 -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 +5 -3
- package/src/widget-sources/widget-query-source.ts +6 -2
- package/src/widget-sources/widget-raster-source.ts +14 -0
- package/src/widget-sources/widget-remote-source.ts +31 -16
- package/src/widget-sources/widget-source.ts +13 -4
- package/src/widget-sources/widget-table-source.ts +6 -2
- package/src/widget-sources/widget-tileset-source.ts +133 -85
|
@@ -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,19 @@
|
|
|
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
|
+
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
7
|
+
import {
|
|
8
|
+
WidgetRasterSource,
|
|
9
|
+
WidgetRasterSourceResult,
|
|
10
|
+
} from '../widget-sources/index.js';
|
|
11
|
+
|
|
6
12
|
import type {
|
|
7
13
|
FilterOptions,
|
|
8
14
|
SourceOptions,
|
|
9
15
|
TilejsonResult,
|
|
10
16
|
TilesetSourceOptions,
|
|
11
|
-
} from './types';
|
|
17
|
+
} from './types.js';
|
|
12
18
|
|
|
13
19
|
export type RasterSourceOptions = SourceOptions &
|
|
14
20
|
TilesetSourceOptions &
|
|
@@ -18,7 +24,7 @@ type UrlParameters = {
|
|
|
18
24
|
filters?: Record<string, unknown>;
|
|
19
25
|
};
|
|
20
26
|
|
|
21
|
-
export type RasterSourceResponse = TilejsonResult;
|
|
27
|
+
export type RasterSourceResponse = TilejsonResult & WidgetRasterSourceResult;
|
|
22
28
|
|
|
23
29
|
export const rasterSource = async function (
|
|
24
30
|
options: RasterSourceOptions
|
|
@@ -29,9 +35,16 @@ export const rasterSource = async function (
|
|
|
29
35
|
urlParameters.filters = filters;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
return baseSource<UrlParameters>(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
return baseSource<UrlParameters>('raster', options, urlParameters).then(
|
|
39
|
+
(result) => ({
|
|
40
|
+
...(result as TilejsonResult),
|
|
41
|
+
widgetSource: new WidgetRasterSource({
|
|
42
|
+
...options,
|
|
43
|
+
tileFormat: getTileFormat(result as TilejsonResult),
|
|
44
|
+
spatialDataColumn: 'quadbin',
|
|
45
|
+
spatialDataType: 'quadbin',
|
|
46
|
+
rasterMetadata: (result as TilejsonResult).raster_metadata!,
|
|
47
|
+
}),
|
|
48
|
+
})
|
|
36
49
|
) as Promise<RasterSourceResponse>;
|
|
37
50
|
};
|
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. */
|
|
@@ -208,7 +208,7 @@ export type SpatialDataType = 'geo' | 'h3' | 'quadbin';
|
|
|
208
208
|
* Strategy used for covering spatial filter geometry with spatial indexes.
|
|
209
209
|
* See https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/quadbin#quadbin_polyfill_mode
|
|
210
210
|
* or https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/h3#h3_polyfill_mode for more information.
|
|
211
|
-
* @
|
|
211
|
+
* @privateRemarks Source: cloud-native maps-api
|
|
212
212
|
* */
|
|
213
213
|
export type SpatialFilterPolyfillMode = 'center' | 'intersects' | 'contains';
|
|
214
214
|
|
|
@@ -373,7 +373,7 @@ export type RasterMetadataBand = {
|
|
|
373
373
|
/**
|
|
374
374
|
* Default color mapping for unique values (or if coloprinterp is `palette`)
|
|
375
375
|
*/
|
|
376
|
-
colortable?: Record<string, number
|
|
376
|
+
colortable?: Record<string, [number, number, number, number]>;
|
|
377
377
|
|
|
378
378
|
/**
|
|
379
379
|
* No value representation.
|
|
@@ -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<
|