@deck.gl/carto 9.0.0-beta.3 → 9.0.0-beta.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/dist/api/carto-api-error.d.ts +1 -1
- package/dist/api/carto-api-error.d.ts.map +1 -1
- package/dist/api/endpoints.d.ts +1 -1
- package/dist/api/endpoints.d.ts.map +1 -1
- package/dist/api/index.d.ts +6 -6
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/layer-map.d.ts +6 -6
- package/dist/api/layer-map.d.ts.map +1 -1
- package/dist/api/query.d.ts +1 -1
- package/dist/api/query.d.ts.map +1 -1
- package/dist/api/request-with-parameters.d.ts +1 -1
- package/dist/api/request-with-parameters.d.ts.map +1 -1
- package/dist/api/types.d.ts +18 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +8 -0
- package/dist/cartoRasterTile-worker.js +1 -1
- package/dist/cartoSpatialTile-worker.js +1 -1
- package/dist/cartoVectorTile-worker.js +1 -1
- package/dist/dist.dev.js +37 -7
- package/dist/index.cjs +33 -10
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/layers/h3-tile-layer.d.ts +2 -2
- package/dist/layers/h3-tile-layer.d.ts.map +1 -1
- package/dist/layers/quadbin-tile-layer.d.ts +3 -3
- package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/dist/layers/raster-layer-vertex.glsl.d.ts +1 -1
- package/dist/layers/raster-layer-vertex.glsl.js +2 -2
- package/dist/layers/raster-layer.d.ts.map +1 -1
- package/dist/layers/raster-layer.js +3 -1
- package/dist/layers/raster-tile-layer.d.ts +3 -3
- package/dist/layers/raster-tile-layer.d.ts.map +1 -1
- package/dist/layers/schema/carto-properties-tile.d.ts +1 -1
- package/dist/layers/schema/carto-properties-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.d.ts +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.d.ts.map +1 -1
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile.d.ts +2 -2
- package/dist/layers/schema/carto-spatial-tile.d.ts.map +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist/layers/utils.d.ts +3 -3
- package/dist/layers/utils.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.d.ts +2 -1
- package/dist/layers/vector-tile-layer.d.ts.map +1 -1
- package/dist/layers/vector-tile-layer.js +5 -1
- package/dist/sources/base-source.d.ts +2 -2
- package/dist/sources/base-source.d.ts.map +1 -1
- package/dist/sources/boundary-query-source.d.ts +4 -3
- package/dist/sources/boundary-query-source.d.ts.map +1 -1
- package/dist/sources/boundary-query-source.js +7 -1
- package/dist/sources/boundary-table-source.d.ts +2 -2
- package/dist/sources/boundary-table-source.d.ts.map +1 -1
- package/dist/sources/boundary-table-source.js +4 -1
- package/dist/sources/h3-query-source.d.ts +1 -1
- package/dist/sources/h3-query-source.d.ts.map +1 -1
- package/dist/sources/h3-table-source.d.ts +1 -1
- package/dist/sources/h3-table-source.d.ts.map +1 -1
- package/dist/sources/h3-tileset-source.d.ts +1 -1
- package/dist/sources/h3-tileset-source.d.ts.map +1 -1
- package/dist/sources/index.d.ts +26 -26
- package/dist/sources/index.d.ts.map +1 -1
- package/dist/sources/quadbin-query-source.d.ts +1 -1
- package/dist/sources/quadbin-query-source.d.ts.map +1 -1
- package/dist/sources/quadbin-table-source.d.ts +1 -1
- package/dist/sources/quadbin-table-source.d.ts.map +1 -1
- package/dist/sources/quadbin-tileset-source.d.ts +1 -1
- package/dist/sources/quadbin-tileset-source.d.ts.map +1 -1
- package/dist/sources/raster-source.d.ts +1 -1
- package/dist/sources/raster-source.d.ts.map +1 -1
- package/dist/sources/types.d.ts +7 -1
- package/dist/sources/types.d.ts.map +1 -1
- package/dist/sources/vector-query-source.d.ts +4 -2
- package/dist/sources/vector-query-source.d.ts.map +1 -1
- package/dist/sources/vector-query-source.js +7 -1
- package/dist/sources/vector-table-source.d.ts +2 -2
- package/dist/sources/vector-table-source.d.ts.map +1 -1
- package/dist/sources/vector-table-source.js +4 -1
- package/dist/sources/vector-tileset-source.d.ts +1 -1
- package/dist/sources/vector-tileset-source.d.ts.map +1 -1
- package/dist/style/color-bins-style.d.ts +2 -2
- package/dist/style/color-bins-style.d.ts.map +1 -1
- package/dist/style/color-categories-style.d.ts +2 -2
- package/dist/style/color-categories-style.d.ts.map +1 -1
- package/dist/style/color-continuous-style.d.ts +2 -2
- package/dist/style/color-continuous-style.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist.min.js +5 -5
- package/package.json +2 -2
- package/src/api/types.ts +20 -0
- package/src/layers/raster-layer-vertex.glsl.ts +2 -2
- package/src/layers/raster-layer.ts +3 -1
- package/src/layers/vector-tile-layer.ts +6 -1
- package/src/sources/boundary-query-source.ts +26 -8
- package/src/sources/boundary-table-source.ts +13 -8
- package/src/sources/types.ts +8 -1
- package/src/sources/vector-query-source.ts +21 -3
- package/src/sources/vector-table-source.ts +13 -3
- package/src/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.0-beta.
|
|
6
|
+
"version": "9.0.0-beta.4",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"@deck.gl/layers": "^9.0.0-alpha",
|
|
75
75
|
"@loaders.gl/core": "^4.1.0"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7063cbec75a5fbcefc51f33f6e2488134533d34a"
|
|
78
78
|
}
|
package/src/api/types.ts
CHANGED
|
@@ -54,6 +54,26 @@ export type VisualChannelField = {
|
|
|
54
54
|
colorColumn?: string;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
export interface Filters {
|
|
58
|
+
[column: string]: Filter;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface Filter {
|
|
62
|
+
[FilterTypes.In]: number[];
|
|
63
|
+
[FilterTypes.Between]: number[][];
|
|
64
|
+
[FilterTypes.ClosedOpen]: number[][];
|
|
65
|
+
[FilterTypes.Time]: number[][];
|
|
66
|
+
[FilterTypes.StringSearch]: string[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export enum FilterTypes {
|
|
70
|
+
In = 'in',
|
|
71
|
+
Between = 'between', // [a, b] both are included
|
|
72
|
+
ClosedOpen = 'closed_open', // [a, b) a is included, b is not
|
|
73
|
+
Time = 'time',
|
|
74
|
+
StringSearch = 'stringSearch'
|
|
75
|
+
}
|
|
76
|
+
|
|
57
77
|
export type VisualChannels = {
|
|
58
78
|
colorField?: VisualChannelField;
|
|
59
79
|
colorScale?: SCALE_TYPE;
|
|
@@ -32,8 +32,8 @@ void main(void) {
|
|
|
32
32
|
vec2 common_position = offset.xy;
|
|
33
33
|
float scale = offset.z;
|
|
34
34
|
|
|
35
|
-
int yIndex = - (gl_InstanceID /
|
|
36
|
-
int xIndex = gl_InstanceID + (yIndex *
|
|
35
|
+
int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
|
|
36
|
+
int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
|
|
37
37
|
common_position += scale * vec2(float(xIndex), float(yIndex));
|
|
38
38
|
|
|
39
39
|
vec4 color = isStroke ? instanceLineColors : instanceFillColors;
|
|
@@ -31,7 +31,9 @@ class RasterColumnLayer extends ColumnLayer {
|
|
|
31
31
|
|
|
32
32
|
getShaders() {
|
|
33
33
|
const shaders = super.getShaders();
|
|
34
|
-
|
|
34
|
+
const data = this.props.data as unknown as Raster & {length: number};
|
|
35
|
+
const BLOCK_WIDTH = data.blockWidth || Math.sqrt(data.length);
|
|
36
|
+
return {...shaders, defines: {...shaders.defines, BLOCK_WIDTH}, vs};
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
initializeState() {
|
|
@@ -35,7 +35,6 @@ type _VectorTileLayerProps = {
|
|
|
35
35
|
data: null | TilejsonResult | Promise<TilejsonResult>;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
// TODO Perhaps we can't subclass MVTLayer and keep types. Better to subclass TileLayer instead?
|
|
39
38
|
// @ts-ignore
|
|
40
39
|
export default class VectorTileLayer<ExtraProps extends {} = {}> extends MVTLayer<
|
|
41
40
|
Required<_VectorTileLayerProps> & ExtraProps
|
|
@@ -47,6 +46,12 @@ export default class VectorTileLayer<ExtraProps extends {} = {}> extends MVTLaye
|
|
|
47
46
|
mvt: boolean;
|
|
48
47
|
};
|
|
49
48
|
|
|
49
|
+
constructor(...propObjects: VectorTileLayerProps[]) {
|
|
50
|
+
// Force externally visible props type, as it is not possible modify via extension
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
super(...propObjects);
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
initializeState(): void {
|
|
51
56
|
super.initializeState();
|
|
52
57
|
this.setState({binary: true});
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import {QueryParameters} from '../api/index';
|
|
2
2
|
import {baseSource} from './base-source';
|
|
3
|
-
import type {SourceOptions, TilejsonResult} from './types';
|
|
3
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
4
4
|
|
|
5
|
-
export type BoundaryQuerySourceOptions = SourceOptions &
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export type BoundaryQuerySourceOptions = SourceOptions &
|
|
6
|
+
FilterOptions & {
|
|
7
|
+
columns?: string[];
|
|
8
|
+
tilesetTableName: string;
|
|
9
|
+
matchingColumn?: string;
|
|
10
|
+
propertiesSqlQuery: string;
|
|
11
|
+
queryParameters?: QueryParameters;
|
|
12
|
+
};
|
|
11
13
|
type UrlParameters = {
|
|
14
|
+
columns?: string;
|
|
15
|
+
filters?: string;
|
|
12
16
|
tilesetTableName: string;
|
|
13
17
|
matchingColumn: string;
|
|
14
18
|
propertiesSqlQuery: string;
|
|
@@ -18,12 +22,26 @@ type UrlParameters = {
|
|
|
18
22
|
export const boundaryQuerySource = async function (
|
|
19
23
|
options: BoundaryQuerySourceOptions
|
|
20
24
|
): Promise<TilejsonResult> {
|
|
21
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
columns,
|
|
27
|
+
filters,
|
|
28
|
+
tilesetTableName,
|
|
29
|
+
matchingColumn = 'id',
|
|
30
|
+
propertiesSqlQuery,
|
|
31
|
+
queryParameters
|
|
32
|
+
} = options;
|
|
22
33
|
const urlParameters: UrlParameters = {
|
|
23
34
|
tilesetTableName,
|
|
24
35
|
matchingColumn,
|
|
25
36
|
propertiesSqlQuery
|
|
26
37
|
};
|
|
38
|
+
|
|
39
|
+
if (columns) {
|
|
40
|
+
urlParameters.columns = columns.join(',');
|
|
41
|
+
}
|
|
42
|
+
if (filters) {
|
|
43
|
+
urlParameters.filters = JSON.stringify(filters);
|
|
44
|
+
}
|
|
27
45
|
if (queryParameters) {
|
|
28
46
|
urlParameters.queryParameters = JSON.stringify(queryParameters);
|
|
29
47
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {baseSource} from './base-source';
|
|
2
|
-
import type {SourceOptions, TilejsonResult} from './types';
|
|
2
|
+
import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
|
|
3
3
|
|
|
4
|
-
export type BoundaryTableSourceOptions = SourceOptions &
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export type BoundaryTableSourceOptions = SourceOptions &
|
|
5
|
+
FilterOptions & {
|
|
6
|
+
tilesetTableName: string;
|
|
7
|
+
columns?: string[];
|
|
8
|
+
matchingColumn?: string;
|
|
9
|
+
propertiesTableName: string;
|
|
10
|
+
};
|
|
10
11
|
type UrlParameters = {
|
|
12
|
+
filters?: string;
|
|
11
13
|
tilesetTableName: string;
|
|
12
14
|
columns?: string;
|
|
13
15
|
matchingColumn: string;
|
|
@@ -17,7 +19,7 @@ type UrlParameters = {
|
|
|
17
19
|
export const boundaryTableSource = async function (
|
|
18
20
|
options: BoundaryTableSourceOptions
|
|
19
21
|
): Promise<TilejsonResult> {
|
|
20
|
-
const {tilesetTableName, columns, matchingColumn = 'id', propertiesTableName} = options;
|
|
22
|
+
const {filters, tilesetTableName, columns, matchingColumn = 'id', propertiesTableName} = options;
|
|
21
23
|
const urlParameters: UrlParameters = {
|
|
22
24
|
tilesetTableName,
|
|
23
25
|
matchingColumn,
|
|
@@ -27,5 +29,8 @@ export const boundaryTableSource = async function (
|
|
|
27
29
|
if (columns) {
|
|
28
30
|
urlParameters.columns = columns.join(',');
|
|
29
31
|
}
|
|
32
|
+
if (filters) {
|
|
33
|
+
urlParameters.filters = JSON.stringify(filters);
|
|
34
|
+
}
|
|
30
35
|
return baseSource<UrlParameters>('boundary', options, urlParameters) as Promise<TilejsonResult>;
|
|
31
36
|
};
|
package/src/sources/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {Feature} from 'geojson';
|
|
2
|
-
import type {Format, MapInstantiation, QueryParameters} from '../api/types';
|
|
2
|
+
import type {Filters, Format, MapInstantiation, QueryParameters} from '../api/types';
|
|
3
3
|
|
|
4
4
|
export type SourceRequiredOptions = {
|
|
5
5
|
/** Carto platform access token. */
|
|
@@ -57,6 +57,13 @@ export type AggregationOptions = {
|
|
|
57
57
|
aggregationResLevel?: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
export type FilterOptions = {
|
|
61
|
+
/**
|
|
62
|
+
* Filters to apply to the data source on the server
|
|
63
|
+
*/
|
|
64
|
+
filters: Filters;
|
|
65
|
+
};
|
|
66
|
+
|
|
60
67
|
export type QuerySourceOptions = {
|
|
61
68
|
/**
|
|
62
69
|
* The column name and the type of geospatial support.
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import {baseSource} from './base-source';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
FilterOptions,
|
|
5
|
+
SourceOptions,
|
|
6
|
+
QuerySourceOptions,
|
|
7
|
+
SpatialDataType,
|
|
8
|
+
TilejsonResult
|
|
9
|
+
} from './types';
|
|
4
10
|
|
|
5
|
-
export type VectorQuerySourceOptions = SourceOptions &
|
|
11
|
+
export type VectorQuerySourceOptions = SourceOptions &
|
|
12
|
+
QuerySourceOptions &
|
|
13
|
+
FilterOptions & {
|
|
14
|
+
columns?: string[];
|
|
15
|
+
};
|
|
6
16
|
type UrlParameters = {
|
|
17
|
+
columns?: string;
|
|
18
|
+
filters?: string;
|
|
7
19
|
spatialDataType: SpatialDataType;
|
|
8
20
|
spatialDataColumn?: string;
|
|
9
21
|
q: string;
|
|
@@ -13,9 +25,15 @@ type UrlParameters = {
|
|
|
13
25
|
export const vectorQuerySource = async function (
|
|
14
26
|
options: VectorQuerySourceOptions
|
|
15
27
|
): Promise<TilejsonResult> {
|
|
16
|
-
const {spatialDataColumn = 'geom', sqlQuery, queryParameters} = options;
|
|
28
|
+
const {columns, filters, spatialDataColumn = 'geom', sqlQuery, queryParameters} = options;
|
|
17
29
|
const urlParameters: UrlParameters = {spatialDataColumn, spatialDataType: 'geo', q: sqlQuery};
|
|
18
30
|
|
|
31
|
+
if (columns) {
|
|
32
|
+
urlParameters.columns = columns.join(',');
|
|
33
|
+
}
|
|
34
|
+
if (filters) {
|
|
35
|
+
urlParameters.filters = JSON.stringify(filters);
|
|
36
|
+
}
|
|
19
37
|
if (queryParameters) {
|
|
20
38
|
urlParameters.queryParameters = JSON.stringify(queryParameters);
|
|
21
39
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import {baseSource} from './base-source';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
FilterOptions,
|
|
5
|
+
SourceOptions,
|
|
6
|
+
SpatialDataType,
|
|
7
|
+
TableSourceOptions,
|
|
8
|
+
TilejsonResult
|
|
9
|
+
} from './types';
|
|
4
10
|
|
|
5
|
-
export type VectorTableSourceOptions = SourceOptions & TableSourceOptions;
|
|
11
|
+
export type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions;
|
|
6
12
|
type UrlParameters = {
|
|
7
13
|
columns?: string;
|
|
14
|
+
filters?: string;
|
|
8
15
|
spatialDataType: SpatialDataType;
|
|
9
16
|
spatialDataColumn?: string;
|
|
10
17
|
name: string;
|
|
@@ -13,11 +20,14 @@ type UrlParameters = {
|
|
|
13
20
|
export const vectorTableSource = async function (
|
|
14
21
|
options: VectorTableSourceOptions
|
|
15
22
|
): Promise<TilejsonResult> {
|
|
16
|
-
const {columns, spatialDataColumn = 'geom', tableName} = options;
|
|
23
|
+
const {columns, filters, spatialDataColumn = 'geom', tableName} = options;
|
|
17
24
|
const urlParameters: UrlParameters = {name: tableName, spatialDataColumn, spatialDataType: 'geo'};
|
|
18
25
|
|
|
19
26
|
if (columns) {
|
|
20
27
|
urlParameters.columns = columns.join(',');
|
|
21
28
|
}
|
|
29
|
+
if (filters) {
|
|
30
|
+
urlParameters.filters = JSON.stringify(filters);
|
|
31
|
+
}
|
|
22
32
|
return baseSource<UrlParameters>('table', options, urlParameters) as Promise<TilejsonResult>;
|
|
23
33
|
};
|
package/src/.DS_Store
DELETED
|
Binary file
|