@carto/api-client 0.3.1 → 0.4.0-alpha.1
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/carto-api-error.d.ts +26 -0
- package/build/api/endpoints.d.ts +24 -0
- package/build/api/index.d.ts +5 -0
- package/build/api/query.d.ts +3 -0
- package/build/api/request-with-parameters.d.ts +8 -0
- package/build/api-client.cjs +724 -65
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +607 -59
- package/build/api-client.modern.js.map +1 -1
- package/build/constants-internal.d.ts +9 -28
- package/build/constants.d.ts +24 -2
- package/build/index.d.ts +5 -1
- package/build/models/model.d.ts +2 -2
- package/build/sources/base-source.d.ts +4 -0
- package/build/sources/boundary-query-source.d.ts +9 -0
- package/build/sources/boundary-table-source.d.ts +7 -0
- package/build/sources/h3-query-source.d.ts +3 -0
- package/build/sources/h3-table-source.d.ts +3 -0
- package/build/sources/h3-tileset-source.d.ts +3 -0
- package/build/sources/index.d.ts +27 -5
- package/build/sources/quadbin-query-source.d.ts +3 -0
- package/build/sources/quadbin-table-source.d.ts +3 -0
- package/build/sources/quadbin-tileset-source.d.ts +3 -0
- package/build/sources/raster-source.d.ts +3 -0
- package/build/sources/types.d.ts +209 -85
- package/build/sources/vector-query-source.d.ts +3 -0
- package/build/sources/vector-table-source.d.ts +3 -0
- package/build/sources/vector-tileset-source.d.ts +3 -0
- package/build/types-internal.d.ts +46 -1
- package/build/types.d.ts +11 -0
- package/build/utils.d.ts +4 -0
- package/build/widget-sources/index.d.ts +5 -0
- package/build/widget-sources/types.d.ts +95 -0
- package/build/{sources → widget-sources}/widget-base-source.d.ts +2 -2
- package/build/{sources → widget-sources}/widget-query-source.d.ts +1 -1
- package/build/{sources → widget-sources}/widget-table-source.d.ts +1 -1
- package/build/{sources → widget-sources}/wrappers.d.ts +1 -1
- package/package.json +4 -3
- package/src/api/carto-api-error.ts +88 -0
- package/src/api/endpoints.ts +84 -0
- package/src/api/index.ts +14 -0
- package/src/api/query.ts +56 -0
- package/src/api/request-with-parameters.ts +135 -0
- package/src/constants-internal.ts +9 -30
- package/src/constants.ts +32 -3
- package/src/global.d.ts +3 -0
- package/src/index.ts +38 -1
- package/src/models/model.ts +4 -6
- package/src/sources/base-source.ts +101 -0
- package/src/sources/boundary-query-source.ts +53 -0
- package/src/sources/boundary-table-source.ts +41 -0
- package/src/sources/h3-query-source.ts +63 -0
- package/src/sources/h3-table-source.ts +59 -0
- package/src/sources/h3-tileset-source.ts +26 -0
- package/src/sources/index.ts +54 -5
- package/src/sources/quadbin-query-source.ts +64 -0
- package/src/sources/quadbin-table-source.ts +60 -0
- package/src/sources/quadbin-tileset-source.ts +26 -0
- package/src/sources/raster-source.ts +34 -0
- package/src/sources/types.ts +221 -89
- package/src/sources/vector-query-source.ts +65 -0
- package/src/sources/vector-table-source.ts +59 -0
- package/src/sources/vector-tileset-source.ts +26 -0
- package/src/types-internal.ts +54 -1
- package/src/types.ts +16 -0
- package/src/utils.ts +8 -0
- package/src/widget-sources/index.ts +5 -0
- package/src/widget-sources/types.ts +105 -0
- package/src/{sources → widget-sources}/widget-base-source.ts +5 -5
- package/src/{sources → widget-sources}/widget-query-source.ts +2 -3
- package/src/{sources → widget-sources}/widget-table-source.ts +2 -3
- package/src/{sources → widget-sources}/wrappers.ts +1 -22
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {QueryParameters} from '../types.js';
|
|
6
|
+
import {baseSource} from './base-source';
|
|
7
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
8
|
+
|
|
9
|
+
export type BoundaryQuerySourceOptions = SourceOptions &
|
|
10
|
+
FilterOptions & {
|
|
11
|
+
columns?: string[];
|
|
12
|
+
tilesetTableName: string;
|
|
13
|
+
propertiesSqlQuery: string;
|
|
14
|
+
queryParameters?: QueryParameters;
|
|
15
|
+
};
|
|
16
|
+
type UrlParameters = {
|
|
17
|
+
columns?: string;
|
|
18
|
+
filters?: Record<string, unknown>;
|
|
19
|
+
tilesetTableName: string;
|
|
20
|
+
propertiesSqlQuery: string;
|
|
21
|
+
queryParameters?: Record<string, unknown> | unknown[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const boundaryQuerySource = async function (
|
|
25
|
+
options: BoundaryQuerySourceOptions
|
|
26
|
+
): Promise<TilejsonResult> {
|
|
27
|
+
const {
|
|
28
|
+
columns,
|
|
29
|
+
filters,
|
|
30
|
+
tilesetTableName,
|
|
31
|
+
propertiesSqlQuery,
|
|
32
|
+
queryParameters,
|
|
33
|
+
} = options;
|
|
34
|
+
const urlParameters: UrlParameters = {
|
|
35
|
+
tilesetTableName,
|
|
36
|
+
propertiesSqlQuery,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (columns) {
|
|
40
|
+
urlParameters.columns = columns.join(',');
|
|
41
|
+
}
|
|
42
|
+
if (filters) {
|
|
43
|
+
urlParameters.filters = filters;
|
|
44
|
+
}
|
|
45
|
+
if (queryParameters) {
|
|
46
|
+
urlParameters.queryParameters = queryParameters;
|
|
47
|
+
}
|
|
48
|
+
return baseSource<UrlParameters>(
|
|
49
|
+
'boundary',
|
|
50
|
+
options,
|
|
51
|
+
urlParameters
|
|
52
|
+
) as Promise<TilejsonResult>;
|
|
53
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {baseSource} from './base-source';
|
|
6
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
7
|
+
|
|
8
|
+
export type BoundaryTableSourceOptions = SourceOptions &
|
|
9
|
+
FilterOptions & {
|
|
10
|
+
tilesetTableName: string;
|
|
11
|
+
columns?: string[];
|
|
12
|
+
propertiesTableName: string;
|
|
13
|
+
};
|
|
14
|
+
type UrlParameters = {
|
|
15
|
+
filters?: Record<string, unknown>;
|
|
16
|
+
tilesetTableName: string;
|
|
17
|
+
columns?: string;
|
|
18
|
+
propertiesTableName: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const boundaryTableSource = async function (
|
|
22
|
+
options: BoundaryTableSourceOptions
|
|
23
|
+
): Promise<TilejsonResult> {
|
|
24
|
+
const {filters, tilesetTableName, columns, propertiesTableName} = options;
|
|
25
|
+
const urlParameters: UrlParameters = {
|
|
26
|
+
tilesetTableName,
|
|
27
|
+
propertiesTableName,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (columns) {
|
|
31
|
+
urlParameters.columns = columns.join(',');
|
|
32
|
+
}
|
|
33
|
+
if (filters) {
|
|
34
|
+
urlParameters.filters = filters;
|
|
35
|
+
}
|
|
36
|
+
return baseSource<UrlParameters>(
|
|
37
|
+
'boundary',
|
|
38
|
+
options,
|
|
39
|
+
urlParameters
|
|
40
|
+
) as Promise<TilejsonResult>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal';
|
|
7
|
+
import {baseSource} from './base-source';
|
|
8
|
+
import type {
|
|
9
|
+
AggregationOptions,
|
|
10
|
+
FilterOptions,
|
|
11
|
+
QuerySourceOptions,
|
|
12
|
+
SourceOptions,
|
|
13
|
+
SpatialDataType,
|
|
14
|
+
TilejsonResult,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
export type H3QuerySourceOptions = SourceOptions &
|
|
18
|
+
QuerySourceOptions &
|
|
19
|
+
AggregationOptions &
|
|
20
|
+
FilterOptions;
|
|
21
|
+
type UrlParameters = {
|
|
22
|
+
aggregationExp: string;
|
|
23
|
+
aggregationResLevel?: string;
|
|
24
|
+
spatialDataType: SpatialDataType;
|
|
25
|
+
spatialDataColumn?: string;
|
|
26
|
+
q: string;
|
|
27
|
+
queryParameters?: Record<string, unknown> | unknown[];
|
|
28
|
+
filters?: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const h3QuerySource = async function (
|
|
32
|
+
options: H3QuerySourceOptions
|
|
33
|
+
): Promise<TilejsonResult> {
|
|
34
|
+
const {
|
|
35
|
+
aggregationExp,
|
|
36
|
+
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
37
|
+
sqlQuery,
|
|
38
|
+
spatialDataColumn = 'h3',
|
|
39
|
+
queryParameters,
|
|
40
|
+
filters,
|
|
41
|
+
} = options;
|
|
42
|
+
const urlParameters: UrlParameters = {
|
|
43
|
+
aggregationExp,
|
|
44
|
+
spatialDataColumn,
|
|
45
|
+
spatialDataType: 'h3',
|
|
46
|
+
q: sqlQuery,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (aggregationResLevel) {
|
|
50
|
+
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
51
|
+
}
|
|
52
|
+
if (queryParameters) {
|
|
53
|
+
urlParameters.queryParameters = queryParameters;
|
|
54
|
+
}
|
|
55
|
+
if (filters) {
|
|
56
|
+
urlParameters.filters = filters;
|
|
57
|
+
}
|
|
58
|
+
return baseSource<UrlParameters>(
|
|
59
|
+
'query',
|
|
60
|
+
options,
|
|
61
|
+
urlParameters
|
|
62
|
+
) as Promise<TilejsonResult>;
|
|
63
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal';
|
|
7
|
+
import {baseSource} from './base-source';
|
|
8
|
+
import type {
|
|
9
|
+
AggregationOptions,
|
|
10
|
+
FilterOptions,
|
|
11
|
+
SourceOptions,
|
|
12
|
+
SpatialDataType,
|
|
13
|
+
TableSourceOptions,
|
|
14
|
+
TilejsonResult,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
export type H3TableSourceOptions = SourceOptions &
|
|
18
|
+
TableSourceOptions &
|
|
19
|
+
AggregationOptions &
|
|
20
|
+
FilterOptions;
|
|
21
|
+
|
|
22
|
+
type UrlParameters = {
|
|
23
|
+
aggregationExp: string;
|
|
24
|
+
aggregationResLevel?: string;
|
|
25
|
+
spatialDataType: SpatialDataType;
|
|
26
|
+
spatialDataColumn?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
filters?: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const h3TableSource = async function (
|
|
32
|
+
options: H3TableSourceOptions
|
|
33
|
+
): Promise<TilejsonResult> {
|
|
34
|
+
const {
|
|
35
|
+
aggregationExp,
|
|
36
|
+
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
37
|
+
spatialDataColumn = 'h3',
|
|
38
|
+
tableName,
|
|
39
|
+
filters,
|
|
40
|
+
} = options;
|
|
41
|
+
const urlParameters: UrlParameters = {
|
|
42
|
+
aggregationExp,
|
|
43
|
+
name: tableName,
|
|
44
|
+
spatialDataColumn,
|
|
45
|
+
spatialDataType: 'h3',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (aggregationResLevel) {
|
|
49
|
+
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
50
|
+
}
|
|
51
|
+
if (filters) {
|
|
52
|
+
urlParameters.filters = filters;
|
|
53
|
+
}
|
|
54
|
+
return baseSource<UrlParameters>(
|
|
55
|
+
'table',
|
|
56
|
+
options,
|
|
57
|
+
urlParameters
|
|
58
|
+
) as Promise<TilejsonResult>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {baseSource} from './base-source';
|
|
6
|
+
import type {
|
|
7
|
+
SourceOptions,
|
|
8
|
+
TilejsonResult,
|
|
9
|
+
TilesetSourceOptions,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
13
|
+
type UrlParameters = {name: string};
|
|
14
|
+
|
|
15
|
+
export const h3TilesetSource = async function (
|
|
16
|
+
options: H3TilesetSourceOptions
|
|
17
|
+
): Promise<TilejsonResult> {
|
|
18
|
+
const {tableName} = options;
|
|
19
|
+
const urlParameters: UrlParameters = {name: tableName};
|
|
20
|
+
|
|
21
|
+
return baseSource<UrlParameters>(
|
|
22
|
+
'tileset',
|
|
23
|
+
options,
|
|
24
|
+
urlParameters
|
|
25
|
+
) as Promise<TilejsonResult>;
|
|
26
|
+
};
|
package/src/sources/index.ts
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
export {SOURCE_DEFAULTS} from './base-source';
|
|
6
|
+
export type {
|
|
7
|
+
TilejsonResult,
|
|
8
|
+
GeojsonResult,
|
|
9
|
+
JsonResult,
|
|
10
|
+
QueryResult,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
export {boundaryQuerySource} from './boundary-query-source';
|
|
14
|
+
export type {BoundaryQuerySourceOptions} from './boundary-query-source';
|
|
15
|
+
|
|
16
|
+
export {boundaryTableSource} from './boundary-table-source';
|
|
17
|
+
export type {BoundaryTableSourceOptions} from './boundary-table-source';
|
|
18
|
+
|
|
19
|
+
export {h3QuerySource} from './h3-query-source';
|
|
20
|
+
export type {H3QuerySourceOptions} from './h3-query-source';
|
|
21
|
+
|
|
22
|
+
export {h3TableSource} from './h3-table-source';
|
|
23
|
+
export type {H3TableSourceOptions} from './h3-table-source';
|
|
24
|
+
|
|
25
|
+
export {h3TilesetSource} from './h3-tileset-source';
|
|
26
|
+
export type {H3TilesetSourceOptions} from './h3-tileset-source';
|
|
27
|
+
|
|
28
|
+
export {rasterSource} from './raster-source';
|
|
29
|
+
export type {RasterSourceOptions} from './raster-source';
|
|
30
|
+
|
|
31
|
+
export {quadbinQuerySource} from './quadbin-query-source';
|
|
32
|
+
export type {QuadbinQuerySourceOptions} from './quadbin-query-source';
|
|
33
|
+
|
|
34
|
+
export {quadbinTableSource} from './quadbin-table-source';
|
|
35
|
+
export type {QuadbinTableSourceOptions} from './quadbin-table-source';
|
|
36
|
+
|
|
37
|
+
export {quadbinTilesetSource} from './quadbin-tileset-source';
|
|
38
|
+
export type {QuadbinTilesetSourceOptions} from './quadbin-tileset-source';
|
|
39
|
+
|
|
40
|
+
export {vectorQuerySource} from './vector-query-source';
|
|
41
|
+
export type {VectorQuerySourceOptions} from './vector-query-source';
|
|
42
|
+
|
|
43
|
+
export {vectorTableSource} from './vector-table-source';
|
|
44
|
+
export type {VectorTableSourceOptions} from './vector-table-source';
|
|
45
|
+
|
|
46
|
+
export {vectorTilesetSource} from './vector-tileset-source';
|
|
47
|
+
export type {VectorTilesetSourceOptions} from './vector-tileset-source';
|
|
48
|
+
|
|
49
|
+
export type {
|
|
50
|
+
SourceOptions,
|
|
51
|
+
QuerySourceOptions,
|
|
52
|
+
TableSourceOptions,
|
|
53
|
+
TilesetSourceOptions,
|
|
54
|
+
} from './types';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
|
|
7
|
+
import {baseSource} from './base-source';
|
|
8
|
+
import type {
|
|
9
|
+
AggregationOptions,
|
|
10
|
+
FilterOptions,
|
|
11
|
+
QuerySourceOptions,
|
|
12
|
+
SourceOptions,
|
|
13
|
+
SpatialDataType,
|
|
14
|
+
TilejsonResult,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
export type QuadbinQuerySourceOptions = SourceOptions &
|
|
18
|
+
QuerySourceOptions &
|
|
19
|
+
AggregationOptions &
|
|
20
|
+
FilterOptions;
|
|
21
|
+
|
|
22
|
+
type UrlParameters = {
|
|
23
|
+
aggregationExp: string;
|
|
24
|
+
aggregationResLevel?: string;
|
|
25
|
+
spatialDataType: SpatialDataType;
|
|
26
|
+
spatialDataColumn?: string;
|
|
27
|
+
q: string;
|
|
28
|
+
queryParameters?: Record<string, unknown> | unknown[];
|
|
29
|
+
filters?: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const quadbinQuerySource = async function (
|
|
33
|
+
options: QuadbinQuerySourceOptions
|
|
34
|
+
): Promise<TilejsonResult> {
|
|
35
|
+
const {
|
|
36
|
+
aggregationExp,
|
|
37
|
+
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
38
|
+
sqlQuery,
|
|
39
|
+
spatialDataColumn = 'quadbin',
|
|
40
|
+
queryParameters,
|
|
41
|
+
filters,
|
|
42
|
+
} = options;
|
|
43
|
+
const urlParameters: UrlParameters = {
|
|
44
|
+
aggregationExp,
|
|
45
|
+
q: sqlQuery,
|
|
46
|
+
spatialDataColumn,
|
|
47
|
+
spatialDataType: 'quadbin',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (aggregationResLevel) {
|
|
51
|
+
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
52
|
+
}
|
|
53
|
+
if (queryParameters) {
|
|
54
|
+
urlParameters.queryParameters = queryParameters;
|
|
55
|
+
}
|
|
56
|
+
if (filters) {
|
|
57
|
+
urlParameters.filters = filters;
|
|
58
|
+
}
|
|
59
|
+
return baseSource<UrlParameters>(
|
|
60
|
+
'query',
|
|
61
|
+
options,
|
|
62
|
+
urlParameters
|
|
63
|
+
) as Promise<TilejsonResult>;
|
|
64
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/* eslint-disable camelcase */
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
|
|
7
|
+
import {baseSource} from './base-source';
|
|
8
|
+
import type {
|
|
9
|
+
AggregationOptions,
|
|
10
|
+
FilterOptions,
|
|
11
|
+
SourceOptions,
|
|
12
|
+
SpatialDataType,
|
|
13
|
+
TableSourceOptions,
|
|
14
|
+
TilejsonResult,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
export type QuadbinTableSourceOptions = SourceOptions &
|
|
18
|
+
TableSourceOptions &
|
|
19
|
+
AggregationOptions &
|
|
20
|
+
FilterOptions;
|
|
21
|
+
|
|
22
|
+
type UrlParameters = {
|
|
23
|
+
aggregationExp: string;
|
|
24
|
+
aggregationResLevel?: string;
|
|
25
|
+
spatialDataType: SpatialDataType;
|
|
26
|
+
spatialDataColumn?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
filters?: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const quadbinTableSource = async function (
|
|
32
|
+
options: QuadbinTableSourceOptions
|
|
33
|
+
): Promise<TilejsonResult> {
|
|
34
|
+
const {
|
|
35
|
+
aggregationExp,
|
|
36
|
+
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
37
|
+
spatialDataColumn = 'quadbin',
|
|
38
|
+
tableName,
|
|
39
|
+
filters,
|
|
40
|
+
} = options;
|
|
41
|
+
|
|
42
|
+
const urlParameters: UrlParameters = {
|
|
43
|
+
aggregationExp,
|
|
44
|
+
name: tableName,
|
|
45
|
+
spatialDataColumn,
|
|
46
|
+
spatialDataType: 'quadbin',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (aggregationResLevel) {
|
|
50
|
+
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
51
|
+
}
|
|
52
|
+
if (filters) {
|
|
53
|
+
urlParameters.filters = filters;
|
|
54
|
+
}
|
|
55
|
+
return baseSource<UrlParameters>(
|
|
56
|
+
'table',
|
|
57
|
+
options,
|
|
58
|
+
urlParameters
|
|
59
|
+
) as Promise<TilejsonResult>;
|
|
60
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {baseSource} from './base-source';
|
|
6
|
+
import type {
|
|
7
|
+
SourceOptions,
|
|
8
|
+
TilejsonResult,
|
|
9
|
+
TilesetSourceOptions,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
export type QuadbinTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
13
|
+
type UrlParameters = {name: string};
|
|
14
|
+
|
|
15
|
+
export const quadbinTilesetSource = async function (
|
|
16
|
+
options: QuadbinTilesetSourceOptions
|
|
17
|
+
): Promise<TilejsonResult> {
|
|
18
|
+
const {tableName} = options;
|
|
19
|
+
const urlParameters: UrlParameters = {name: tableName};
|
|
20
|
+
|
|
21
|
+
return baseSource<UrlParameters>(
|
|
22
|
+
'tileset',
|
|
23
|
+
options,
|
|
24
|
+
urlParameters
|
|
25
|
+
) as Promise<TilejsonResult>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {baseSource} from './base-source';
|
|
6
|
+
import type {
|
|
7
|
+
FilterOptions,
|
|
8
|
+
SourceOptions,
|
|
9
|
+
TilejsonResult,
|
|
10
|
+
TilesetSourceOptions,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
export type RasterSourceOptions = SourceOptions &
|
|
14
|
+
TilesetSourceOptions &
|
|
15
|
+
FilterOptions;
|
|
16
|
+
type UrlParameters = {
|
|
17
|
+
name: string;
|
|
18
|
+
filters?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const rasterSource = async function (
|
|
22
|
+
options: RasterSourceOptions
|
|
23
|
+
): Promise<TilejsonResult> {
|
|
24
|
+
const {tableName, filters} = options;
|
|
25
|
+
const urlParameters: UrlParameters = {name: tableName};
|
|
26
|
+
if (filters) {
|
|
27
|
+
urlParameters.filters = filters;
|
|
28
|
+
}
|
|
29
|
+
return baseSource<UrlParameters>(
|
|
30
|
+
'raster',
|
|
31
|
+
options,
|
|
32
|
+
urlParameters
|
|
33
|
+
) as Promise<TilejsonResult>;
|
|
34
|
+
};
|