@deck.gl/carto 8.8.4 → 8.8.7
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/dist.dev.js +31412 -22945
- package/dist/es5/api/index.js.map +1 -1
- package/dist/es5/api/layer-map.js +104 -17
- package/dist/es5/api/layer-map.js.map +1 -1
- package/dist/es5/api/maps-api-common.js.map +1 -1
- package/dist/es5/api/maps-v3-client.js +230 -57
- package/dist/es5/api/maps-v3-client.js.map +1 -1
- package/dist/es5/api/parseMap.js +14 -4
- package/dist/es5/api/parseMap.js.map +1 -1
- package/dist/es5/config.js +11 -2
- package/dist/es5/config.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/layers/carto-layer.js +15 -23
- package/dist/es5/layers/carto-layer.js.map +1 -1
- package/dist/es5/layers/carto-tile-layer.js +1 -1
- package/dist/es5/layers/carto-tile-layer.js.map +1 -1
- package/dist/es5/layers/quadbin-utils.js +2 -0
- package/dist/es5/layers/quadbin-utils.js.map +1 -1
- package/dist/es5/layers/schema/carto-spatial-tile-loader.js +99 -0
- package/dist/es5/layers/schema/carto-spatial-tile-loader.js.map +1 -0
- package/dist/es5/layers/schema/carto-spatial-tile.js +117 -0
- package/dist/es5/layers/schema/carto-spatial-tile.js.map +1 -0
- package/dist/es5/layers/schema/carto-tile.js +5 -1
- package/dist/es5/layers/schema/carto-tile.js.map +1 -1
- package/dist/es5/layers/schema/spatialjson-utils.js +41 -0
- package/dist/es5/layers/schema/spatialjson-utils.js.map +1 -0
- package/dist/es5/layers/spatial-index-tile-layer.js +6 -0
- package/dist/es5/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/layer-map.js +79 -14
- package/dist/esm/api/layer-map.js.map +1 -1
- package/dist/esm/api/maps-api-common.js.map +1 -1
- package/dist/esm/api/maps-v3-client.js +129 -16
- package/dist/esm/api/maps-v3-client.js.map +1 -1
- package/dist/esm/api/parseMap.js +18 -4
- package/dist/esm/api/parseMap.js.map +1 -1
- package/dist/esm/config.js +10 -2
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layers/carto-layer.js +12 -19
- package/dist/esm/layers/carto-layer.js.map +1 -1
- package/dist/esm/layers/carto-tile-layer.js +1 -1
- package/dist/esm/layers/carto-tile-layer.js.map +1 -1
- package/dist/esm/layers/quadbin-utils.js +2 -5
- package/dist/esm/layers/quadbin-utils.js.map +1 -1
- package/dist/esm/layers/schema/carto-spatial-tile-loader.js +56 -0
- package/dist/esm/layers/schema/carto-spatial-tile-loader.js.map +1 -0
- package/dist/esm/layers/schema/carto-spatial-tile.js +72 -0
- package/dist/esm/layers/schema/carto-spatial-tile.js.map +1 -0
- package/dist/esm/layers/schema/carto-tile.js +2 -2
- package/dist/esm/layers/schema/carto-tile.js.map +1 -1
- package/dist/esm/layers/schema/spatialjson-utils.js +26 -0
- package/dist/esm/layers/schema/spatialjson-utils.js.map +1 -0
- package/dist/esm/layers/spatial-index-tile-layer.js +3 -0
- package/dist/esm/layers/spatial-index-tile-layer.js.map +1 -1
- package/dist.min.js +138 -138
- package/package.json +2 -2
- package/src/api/index.ts +1 -0
- package/src/api/layer-map.ts +76 -13
- package/src/api/maps-api-common.ts +8 -0
- package/src/api/maps-v3-client.ts +148 -21
- package/src/api/parseMap.ts +6 -2
- package/src/config.ts +12 -2
- package/src/index.ts +1 -1
- package/src/layers/carto-layer.ts +26 -33
- package/src/layers/carto-tile-layer.ts +6 -3
- package/src/layers/quadbin-utils.ts +2 -2
- package/src/layers/schema/carto-spatial-tile-loader.ts +59 -0
- package/src/layers/schema/carto-spatial-tile.ts +83 -0
- package/src/layers/schema/carto-tile.ts +6 -6
- package/src/layers/schema/spatialjson-utils.ts +35 -0
- package/src/layers/spatial-index-tile-layer.ts +4 -0
- package/typed/api/index.d.ts +1 -0
- package/typed/api/index.d.ts.map +1 -1
- package/typed/api/layer-map.d.ts +12 -4
- package/typed/api/layer-map.d.ts.map +1 -1
- package/typed/api/maps-api-common.d.ts +4 -0
- package/typed/api/maps-api-common.d.ts.map +1 -1
- package/typed/api/maps-v3-client.d.ts +8 -4
- package/typed/api/maps-v3-client.d.ts.map +1 -1
- package/typed/config.d.ts +2 -0
- package/typed/config.d.ts.map +1 -1
- package/typed/index.d.ts +1 -0
- package/typed/index.d.ts.map +1 -1
- package/typed/layers/carto-layer.d.ts +8 -8
- package/typed/layers/carto-layer.d.ts.map +1 -1
- package/typed/layers/carto-tile-layer.d.ts.map +1 -1
- package/typed/layers/quadbin-utils.d.ts +2 -0
- package/typed/layers/quadbin-utils.d.ts.map +1 -1
- package/typed/layers/schema/carto-spatial-tile-loader.d.ts +4 -0
- package/typed/layers/schema/carto-spatial-tile-loader.d.ts.map +1 -0
- package/typed/layers/schema/carto-spatial-tile.d.ts +21 -0
- package/typed/layers/schema/carto-spatial-tile.d.ts.map +1 -0
- package/typed/layers/schema/carto-tile.d.ts +15 -3
- package/typed/layers/schema/carto-tile.d.ts.map +1 -1
- package/typed/layers/schema/spatialjson-utils.d.ts +25 -0
- package/typed/layers/schema/spatialjson-utils.d.ts.map +1 -0
- package/typed/layers/spatial-index-tile-layer.d.ts.map +1 -1
- package/typed/api/index.js +0 -3
- package/typed/api/layer-map.js +0 -264
- package/typed/api/maps-api-common.js +0 -50
- package/typed/api/maps-client.js +0 -125
- package/typed/api/maps-v3-client.js +0 -304
- package/typed/api/parseMap.js +0 -178
- package/typed/basemap.js +0 -9
- package/typed/config.js +0 -35
- package/typed/index.js +0 -10
- package/typed/layers/carto-layer.js +0 -173
- package/typed/layers/carto-tile-layer.js +0 -105
- package/typed/layers/h3-tile-layer.js +0 -47
- package/typed/layers/h3-tileset-2d.js +0 -85
- package/typed/layers/quadkey-tile-layer.d.ts +0 -21
- package/typed/layers/quadkey-tile-layer.d.ts.map +0 -1
- package/typed/layers/quadkey-tile-layer.js +0 -42
- package/typed/layers/quadkey-tileset-2d.d.ts +0 -15
- package/typed/layers/quadkey-tileset-2d.d.ts.map +0 -1
- package/typed/layers/quadkey-tileset-2d.js +0 -36
- package/typed/layers/schema/carto-tile.js +0 -161
- package/typed/layers/spatial-index-tile-layer.js +0 -40
- package/typed/style/color-bins-style.js +0 -12
- package/typed/style/color-categories-style.js +0 -16
- package/typed/style/color-continuous-style.js +0 -12
- package/typed/style/palette.js +0 -62
- package/typed/style/utils.js +0 -15
- package/typed/utils.js +0 -4
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompositeLayer,
|
|
3
|
-
Layer,
|
|
4
|
-
log,
|
|
5
3
|
CompositeLayerProps,
|
|
4
|
+
Layer,
|
|
6
5
|
LayerProps,
|
|
7
|
-
|
|
6
|
+
log,
|
|
7
|
+
UpdateParameters
|
|
8
8
|
} from '@deck.gl/core';
|
|
9
|
-
|
|
10
|
-
import H3TileLayer from './h3-tile-layer';
|
|
11
|
-
import QuadbinTileLayer from './quadbin-tile-layer';
|
|
9
|
+
|
|
12
10
|
import {MVTLayer} from '@deck.gl/geo-layers';
|
|
13
11
|
import {fetchLayerData, getDataV2, API_VERSIONS} from '../api';
|
|
12
|
+
import {layerFromTileDataset} from '../api/layer-map';
|
|
14
13
|
import {
|
|
15
14
|
COLUMNS_SUPPORT,
|
|
16
15
|
FORMATS,
|
|
@@ -18,7 +17,7 @@ import {
|
|
|
18
17
|
MapType,
|
|
19
18
|
MAP_TYPES,
|
|
20
19
|
TileFormat,
|
|
21
|
-
|
|
20
|
+
QueryParameters
|
|
22
21
|
} from '../api/maps-api-common';
|
|
23
22
|
import {
|
|
24
23
|
ClassicCredentials,
|
|
@@ -26,7 +25,7 @@ import {
|
|
|
26
25
|
Credentials,
|
|
27
26
|
getDefaultCredentials
|
|
28
27
|
} from '../config';
|
|
29
|
-
import {FetchLayerDataResult} from '../api/maps-v3-client';
|
|
28
|
+
import {FetchLayerDataResult, Headers} from '../api/maps-v3-client';
|
|
30
29
|
import {assert} from '../utils';
|
|
31
30
|
|
|
32
31
|
const defaultProps = {
|
|
@@ -62,11 +61,17 @@ const defaultProps = {
|
|
|
62
61
|
// (Array<String>, optional): names of columns to fetch. By default, all columns are fetched.
|
|
63
62
|
columns: {type: 'array', value: null},
|
|
64
63
|
|
|
64
|
+
// (Headers, optional): Custom headers to include in the map instantiation request.
|
|
65
|
+
headers: {type: 'object', value: {}, optional: true},
|
|
66
|
+
|
|
65
67
|
// (String, optional): aggregation SQL expression. Only used for spatial index datasets
|
|
66
68
|
aggregationExp: null,
|
|
67
69
|
|
|
68
70
|
// (Number, optional): aggregation resolution level. Only used for spatial index datasets, defaults to 6 for quadbins, 4 for h3
|
|
69
|
-
aggregationResLevel: null
|
|
71
|
+
aggregationResLevel: null,
|
|
72
|
+
|
|
73
|
+
// (QueryParameters, optional): query parameters to be sent to the server.
|
|
74
|
+
queryParameters: null
|
|
70
75
|
};
|
|
71
76
|
|
|
72
77
|
/** All properties supported by CartoLayer. */
|
|
@@ -146,11 +151,17 @@ type _CartoLayerProps = {
|
|
|
146
151
|
|
|
147
152
|
clientId?: string;
|
|
148
153
|
|
|
154
|
+
/** Custom headers to include in the map instantiation request **/
|
|
155
|
+
headers?: Headers;
|
|
156
|
+
|
|
149
157
|
/** Aggregation SQL expression. Only used for spatial index datasets **/
|
|
150
158
|
aggregationExp?: string;
|
|
151
159
|
|
|
152
160
|
/** Aggregation resolution level. Only used for spatial index datasets, defaults to 6 for quadbins, 4 for h3. **/
|
|
153
161
|
aggregationResLevel?: number;
|
|
162
|
+
|
|
163
|
+
/** Query parameters to be sent to the server. **/
|
|
164
|
+
queryParameters?: QueryParameters;
|
|
154
165
|
};
|
|
155
166
|
|
|
156
167
|
export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
@@ -209,16 +220,7 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
222
|
|
|
212
|
-
updateState({
|
|
213
|
-
props,
|
|
214
|
-
oldProps,
|
|
215
|
-
changeFlags
|
|
216
|
-
}: {
|
|
217
|
-
props: CartoLayerProps;
|
|
218
|
-
oldProps: CartoLayerProps;
|
|
219
|
-
context: any;
|
|
220
|
-
changeFlags: ChangeFlags;
|
|
221
|
-
}): void {
|
|
223
|
+
updateState({props, oldProps, changeFlags}: UpdateParameters<this>) {
|
|
222
224
|
this._checkProps(props);
|
|
223
225
|
const shouldUpdateData =
|
|
224
226
|
changeFlags.dataChanged ||
|
|
@@ -229,7 +231,8 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
|
229
231
|
props.formatTiles !== oldProps.formatTiles ||
|
|
230
232
|
props.type !== oldProps.type ||
|
|
231
233
|
JSON.stringify(props.columns) !== JSON.stringify(oldProps.columns) ||
|
|
232
|
-
JSON.stringify(props.credentials) !== JSON.stringify(oldProps.credentials)
|
|
234
|
+
JSON.stringify(props.credentials) !== JSON.stringify(oldProps.credentials) ||
|
|
235
|
+
JSON.stringify(props.queryParameters) !== JSON.stringify(oldProps.queryParameters);
|
|
233
236
|
|
|
234
237
|
if (shouldUpdateData) {
|
|
235
238
|
this.setState({data: null, apiVersion: null});
|
|
@@ -240,7 +243,7 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
|
240
243
|
|
|
241
244
|
async _updateData(): Promise<void> {
|
|
242
245
|
try {
|
|
243
|
-
const {type, data: source,
|
|
246
|
+
const {type, data: source, credentials, connection, ...rest} = this.props;
|
|
244
247
|
const localConfig = {...getDefaultCredentials(), ...credentials};
|
|
245
248
|
const {apiVersion} = localConfig;
|
|
246
249
|
|
|
@@ -253,7 +256,6 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
|
253
256
|
result = await fetchLayerData({
|
|
254
257
|
type,
|
|
255
258
|
source,
|
|
256
|
-
clientId,
|
|
257
259
|
credentials: credentials as CloudNativeCredentials,
|
|
258
260
|
connection,
|
|
259
261
|
...rest,
|
|
@@ -294,19 +296,10 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<
|
|
|
294
296
|
|
|
295
297
|
/* global URL */
|
|
296
298
|
const tileUrl = new URL(data.tiles[0]);
|
|
297
|
-
|
|
298
299
|
props.formatTiles =
|
|
299
|
-
props.formatTiles ||
|
|
300
|
-
(tileUrl.searchParams.get('formatTiles') as TileFormat) ||
|
|
301
|
-
TILE_FORMATS.MVT;
|
|
300
|
+
props.formatTiles || (tileUrl.searchParams.get('formatTiles') as TileFormat);
|
|
302
301
|
|
|
303
|
-
|
|
304
|
-
return [H3TileLayer, props];
|
|
305
|
-
}
|
|
306
|
-
if (data.scheme === 'quadbin') {
|
|
307
|
-
return [QuadbinTileLayer, props];
|
|
308
|
-
}
|
|
309
|
-
return props.formatTiles === TILE_FORMATS.MVT ? [MVTLayer, props] : [CartoTileLayer, props];
|
|
302
|
+
return [layerFromTileDataset(props.formatTiles, data.scheme), props];
|
|
310
303
|
}
|
|
311
304
|
|
|
312
305
|
renderLayers(): Layer | null {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@deck.gl/geo-layers';
|
|
13
13
|
import {GeoJsonLayer} from '@deck.gl/layers';
|
|
14
14
|
import {geojsonToBinary} from '@loaders.gl/gis';
|
|
15
|
-
import {
|
|
15
|
+
import {KeyValueProperties, Tile, TileReader} from './schema/carto-tile';
|
|
16
16
|
import {TileFormat, TILE_FORMATS} from '../api/maps-api-common';
|
|
17
17
|
import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
18
18
|
import type {BinaryFeatures} from '@loaders.gl/schema';
|
|
@@ -28,7 +28,7 @@ function parsePbf(buffer: ArrayBuffer): Tile {
|
|
|
28
28
|
return tile;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function unpackProperties(properties:
|
|
31
|
+
function unpackProperties(properties: KeyValueProperties[]) {
|
|
32
32
|
if (!properties || !properties.length) {
|
|
33
33
|
return [];
|
|
34
34
|
}
|
|
@@ -67,7 +67,10 @@ const CartoTileLoader: LoaderWithParser = {
|
|
|
67
67
|
id: 'cartoTile',
|
|
68
68
|
module: 'carto',
|
|
69
69
|
extensions: ['pbf'],
|
|
70
|
-
mimeTypes: [
|
|
70
|
+
mimeTypes: [
|
|
71
|
+
'application/vnd.carto-vector-tile',
|
|
72
|
+
'application/x-protobuf' // Back-compatibility
|
|
73
|
+
],
|
|
71
74
|
category: 'geometry',
|
|
72
75
|
worker: false,
|
|
73
76
|
parse: async (arrayBuffer, options) => parseCartoTile(arrayBuffer, options),
|
|
@@ -12,11 +12,11 @@ const B = [
|
|
|
12
12
|
];
|
|
13
13
|
const S = [0n, 1n, 2n, 4n, 8n, 16n];
|
|
14
14
|
|
|
15
|
-
function indexToBigInt(index: string): bigint {
|
|
15
|
+
export function indexToBigInt(index: string): bigint {
|
|
16
16
|
return BigInt(`0x${index}`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function bigIntToIndex(quadbin: bigint): string {
|
|
19
|
+
export function bigIntToIndex(quadbin: bigint): string {
|
|
20
20
|
return quadbin.toString(16);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Protobuf from 'pbf';
|
|
2
|
+
import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
3
|
+
|
|
4
|
+
import {KeyValueProperties} from './carto-tile';
|
|
5
|
+
import {binaryToSpatialjson, Properties, SpatialJson} from './spatialjson-utils';
|
|
6
|
+
import {Tile, TileReader} from './carto-spatial-tile';
|
|
7
|
+
|
|
8
|
+
const CartoSpatialTileLoader: LoaderWithParser = {
|
|
9
|
+
name: 'CARTO Spatial Tile',
|
|
10
|
+
version: '1',
|
|
11
|
+
id: 'cartoSpatialTile',
|
|
12
|
+
module: 'carto',
|
|
13
|
+
extensions: ['pbf'],
|
|
14
|
+
mimeTypes: [
|
|
15
|
+
'application/vnd.carto-spatial-tile',
|
|
16
|
+
'application/x-protobuf' // Back-compatibility
|
|
17
|
+
],
|
|
18
|
+
category: 'geometry',
|
|
19
|
+
worker: false,
|
|
20
|
+
parse: async (arrayBuffer, options) => parseCartoSpatialTile(arrayBuffer, options),
|
|
21
|
+
parseSync: parseCartoSpatialTile,
|
|
22
|
+
options: {}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function parsePbf(buffer: ArrayBuffer): Tile {
|
|
26
|
+
const pbf = new Protobuf(buffer);
|
|
27
|
+
const tile = TileReader.read(pbf);
|
|
28
|
+
return tile;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function unpackProperties(properties: KeyValueProperties[]): Properties[] {
|
|
32
|
+
if (!properties || !properties.length) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
return properties.map(item => {
|
|
36
|
+
const currentRecord: Properties = {};
|
|
37
|
+
item.data.forEach(({key, value}) => {
|
|
38
|
+
currentRecord[key] = value;
|
|
39
|
+
});
|
|
40
|
+
return currentRecord;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function parseCartoSpatialTile(
|
|
45
|
+
arrayBuffer: ArrayBuffer,
|
|
46
|
+
options?: LoaderOptions
|
|
47
|
+
): SpatialJson | null {
|
|
48
|
+
if (!arrayBuffer) return null;
|
|
49
|
+
const tile = parsePbf(arrayBuffer);
|
|
50
|
+
|
|
51
|
+
const {cells} = tile;
|
|
52
|
+
const data = {
|
|
53
|
+
cells: {...cells, properties: unpackProperties(cells.properties)}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return binaryToSpatialjson(data);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default CartoSpatialTileLoader;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {Indices, IndexScheme} from './spatialjson-utils';
|
|
2
|
+
import {
|
|
3
|
+
KeyValueProperties,
|
|
4
|
+
NumericProp,
|
|
5
|
+
NumericPropKeyValueReader,
|
|
6
|
+
PropertiesReader
|
|
7
|
+
} from './carto-tile';
|
|
8
|
+
|
|
9
|
+
// Indices =====================================
|
|
10
|
+
|
|
11
|
+
export class IndicesReader {
|
|
12
|
+
static read(pbf, end?: number): Indices {
|
|
13
|
+
const {value} = pbf.readFields(IndicesReader._readField, {value: []}, end);
|
|
14
|
+
return {value: new BigUint64Array(value)};
|
|
15
|
+
}
|
|
16
|
+
static _readField(this: void, tag: number, obj, pbf) {
|
|
17
|
+
if (tag === 1) readPackedFixed64(pbf, obj.value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Cells =========================================
|
|
22
|
+
|
|
23
|
+
interface Cells {
|
|
24
|
+
indices: Indices;
|
|
25
|
+
properties: KeyValueProperties[];
|
|
26
|
+
numericProps: Record<string, NumericProp>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class CellsReader {
|
|
30
|
+
static read(pbf, end?: number): Cells {
|
|
31
|
+
return pbf.readFields(
|
|
32
|
+
CellsReader._readField,
|
|
33
|
+
{indices: null, properties: [], numericProps: {}},
|
|
34
|
+
end
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
static _readField(this: void, tag: number, obj: Cells, pbf) {
|
|
38
|
+
if (tag === 1) obj.indices = IndicesReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
39
|
+
else if (tag === 2) obj.properties.push(PropertiesReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
40
|
+
else if (tag === 3) {
|
|
41
|
+
const entry = NumericPropKeyValueReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
42
|
+
obj.numericProps[entry.key] = entry.value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Tile ========================================
|
|
48
|
+
|
|
49
|
+
// TODO this type is very similar to SpatialBinary, should align
|
|
50
|
+
export interface Tile {
|
|
51
|
+
scheme: IndexScheme;
|
|
52
|
+
cells: Cells;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export class TileReader {
|
|
56
|
+
static read(pbf, end?: number): Tile {
|
|
57
|
+
return pbf.readFields(TileReader._readField, {scheme: 0, cells: null}, end);
|
|
58
|
+
}
|
|
59
|
+
static _readField(this: void, tag: number, obj: Tile, pbf) {
|
|
60
|
+
if (tag === 1) obj.scheme = pbf.readVarint();
|
|
61
|
+
else if (tag === 2) obj.cells = CellsReader.read(pbf, pbf.readVarint() + pbf.pos);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// pbf doesn't support BigInt natively, implement support for packed fixed64 type
|
|
66
|
+
const SHIFT_LEFT_32 = BigInt((1 << 16) * (1 << 16));
|
|
67
|
+
|
|
68
|
+
function readPackedEnd(pbf) {
|
|
69
|
+
return pbf.type === 2 ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
|
|
70
|
+
}
|
|
71
|
+
function readFixed64(pbf) {
|
|
72
|
+
const a = BigInt(pbf.readFixed32());
|
|
73
|
+
const b = BigInt(pbf.readFixed32());
|
|
74
|
+
return a + b * SHIFT_LEFT_32;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function readPackedFixed64(pbf, arr) {
|
|
78
|
+
if (pbf.type !== 2) return arr.push(readFixed64(pbf));
|
|
79
|
+
const end = readPackedEnd(pbf);
|
|
80
|
+
arr = arr || [];
|
|
81
|
+
while (pbf.pos < end) arr.push(readFixed64(pbf));
|
|
82
|
+
return arr;
|
|
83
|
+
}
|
|
@@ -16,15 +16,15 @@ class KeyValueObjectReader {
|
|
|
16
16
|
|
|
17
17
|
// Properties ========================================
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface KeyValueProperties {
|
|
20
20
|
data: KeyValueObject[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
class PropertiesReader {
|
|
23
|
+
export class PropertiesReader {
|
|
24
24
|
static read(pbf, end?: number) {
|
|
25
25
|
return pbf.readFields(PropertiesReader._readField, {data: []}, end);
|
|
26
26
|
}
|
|
27
|
-
static _readField(this: void, tag: number, obj:
|
|
27
|
+
static _readField(this: void, tag: number, obj: KeyValueProperties, pbf) {
|
|
28
28
|
if (tag === 1) obj.data.push(KeyValueObjectReader.read(pbf, pbf.readVarint() + pbf.pos));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -69,7 +69,7 @@ class IntsReader {
|
|
|
69
69
|
|
|
70
70
|
// NumericProp ========================================
|
|
71
71
|
|
|
72
|
-
interface NumericProp {
|
|
72
|
+
export interface NumericProp {
|
|
73
73
|
value: number[];
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -88,7 +88,7 @@ interface NumbericPropKeyValue {
|
|
|
88
88
|
value: NumericProp;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
class NumericPropKeyValueReader {
|
|
91
|
+
export class NumericPropKeyValueReader {
|
|
92
92
|
static read(pbf, end?: number): NumbericPropKeyValue {
|
|
93
93
|
return pbf.readFields(NumericPropKeyValueReader._readField, {key: '', value: null}, end);
|
|
94
94
|
}
|
|
@@ -104,7 +104,7 @@ interface Points {
|
|
|
104
104
|
positions: Doubles;
|
|
105
105
|
globalFeatureIds: Ints;
|
|
106
106
|
featureIds: Ints;
|
|
107
|
-
properties:
|
|
107
|
+
properties: KeyValueProperties[];
|
|
108
108
|
numericProps: Record<string, NumericProp>;
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {bigIntToIndex} from '../quadbin-utils';
|
|
2
|
+
|
|
3
|
+
export type IndexScheme = 'h3' | 'quadbin';
|
|
4
|
+
type TypedArray = Float32Array | Float64Array;
|
|
5
|
+
|
|
6
|
+
export type Indices = {value: BigUint64Array};
|
|
7
|
+
export type NumericProps = Record<string, {value: number[] | TypedArray}>;
|
|
8
|
+
export type Properties = Record<string, string | number | boolean | null>;
|
|
9
|
+
export type Cells = {
|
|
10
|
+
indices: Indices;
|
|
11
|
+
numericProps: NumericProps;
|
|
12
|
+
properties: Properties[];
|
|
13
|
+
};
|
|
14
|
+
export type SpatialBinary = {scheme?: IndexScheme; cells: Cells};
|
|
15
|
+
export type SpatialJson = {
|
|
16
|
+
id: string;
|
|
17
|
+
properties: Properties;
|
|
18
|
+
}[];
|
|
19
|
+
|
|
20
|
+
export function binaryToSpatialjson(binary: SpatialBinary): SpatialJson {
|
|
21
|
+
const {cells} = binary;
|
|
22
|
+
const count = cells.indices.value.length;
|
|
23
|
+
const spatial: any[] = [];
|
|
24
|
+
for (let i = 0; i < count; i++) {
|
|
25
|
+
const id = bigIntToIndex(cells.indices.value[i]);
|
|
26
|
+
|
|
27
|
+
const properties = {...cells.properties[i]};
|
|
28
|
+
for (const key of Object.keys(cells.numericProps)) {
|
|
29
|
+
properties[key] = cells.numericProps[key].value[i];
|
|
30
|
+
}
|
|
31
|
+
spatial.push({id, properties});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return spatial;
|
|
35
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {registerLoaders} from '@loaders.gl/core';
|
|
2
|
+
import CartoSpatialTileLoader from './schema/carto-spatial-tile-loader';
|
|
3
|
+
registerLoaders([CartoSpatialTileLoader]);
|
|
4
|
+
|
|
1
5
|
import {PickingInfo} from '@deck.gl/core';
|
|
2
6
|
import {TileLayer, _Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers';
|
|
3
7
|
|
package/typed/api/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS } from './maps-api-common';
|
|
2
|
+
export type { QueryParameters } from './maps-api-common';
|
|
2
3
|
export { getDataV2, CONNECTIONS } from './maps-client';
|
|
3
4
|
export { fetchLayerData, fetchMap, mapInstantiation } from './maps-v3-client';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/typed/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACjF,YAAY,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC"}
|
package/typed/api/layer-map.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { scaleLinear, scaleOrdinal, scaleLog, scalePoint, scaleQuantile, scaleQuantize, scaleSqrt, scaleThreshold } from 'd3-scale';
|
|
2
2
|
import { Layer, _ConstructorOf as ConstructorOf } from '@deck.gl/core/typed';
|
|
3
|
+
import { MVTLayer } from '@deck.gl/geo-layers/typed';
|
|
4
|
+
import CartoTileLayer from '../layers/carto-tile-layer';
|
|
5
|
+
import H3TileLayer from '../layers/h3-tile-layer';
|
|
6
|
+
import QuadbinTileLayer from '../layers/quadbin-tile-layer';
|
|
3
7
|
declare const SCALE_FUNCS: {
|
|
4
8
|
linear: typeof scaleLinear;
|
|
5
9
|
ordinal: typeof scaleOrdinal;
|
|
@@ -27,6 +31,7 @@ export declare function getLayer(type: string, config: any, dataset: any): {
|
|
|
27
31
|
propMap: any;
|
|
28
32
|
defaultProps: any;
|
|
29
33
|
};
|
|
34
|
+
export declare function layerFromTileDataset(formatTiles: string | null | undefined, scheme: string): typeof CartoTileLayer | typeof H3TileLayer | typeof MVTLayer | typeof QuadbinTileLayer;
|
|
30
35
|
declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
|
|
31
36
|
export declare function opacityToAlpha(opacity: any): number;
|
|
32
37
|
export declare function getColorValueAccessor({ name }: {
|
|
@@ -34,13 +39,16 @@ export declare function getColorValueAccessor({ name }: {
|
|
|
34
39
|
}, colorAggregation: any, data: any): any;
|
|
35
40
|
export declare function getColorAccessor({ name }: {
|
|
36
41
|
name: any;
|
|
37
|
-
}, scaleType: SCALE_TYPE, { colors, colorMap }: {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
}, scaleType: SCALE_TYPE, { aggregation, range: { colors, colorMap } }: {
|
|
43
|
+
aggregation: any;
|
|
44
|
+
range: {
|
|
45
|
+
colors: any;
|
|
46
|
+
colorMap: any;
|
|
47
|
+
};
|
|
40
48
|
}, opacity: number | undefined, data: any): any;
|
|
41
49
|
export declare function getSizeAccessor({ name }: {
|
|
42
50
|
name: any;
|
|
43
|
-
}, scaleType: SCALE_TYPE, range: Iterable<Range>, data: any): any;
|
|
51
|
+
}, scaleType: SCALE_TYPE, aggregation: any, range: Iterable<Range>, data: any): any;
|
|
44
52
|
export declare function getTextAccessor({ name, type }: {
|
|
45
53
|
name: any;
|
|
46
54
|
type: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-map.d.ts","sourceRoot":"","sources":["../../src/api/layer-map.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,UAAU,CAAC;AAIlB,OAAO,EAAC,KAAK,EAAE,cAAc,IAAI,aAAa,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"layer-map.d.ts","sourceRoot":"","sources":["../../src/api/layer-map.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UA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;CAAA,EACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,GAAG,OAmCV;AAED,wBAAgB,eAAe,CAC7B,EAAC,IAAI,EAAC;;CAAA,EACN,SAAS,EAAE,UAAU,EACrB,WAAW,KAAA,EACX,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EACtB,IAAI,EAAE,GAAG,OAeV;AAUD,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC;;;CAAA,EAAE,IAAI,KAAA,OAMjD;AAED,wBAAgB,0BAA0B,CAAC,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC;;;;CAAA,EAAE,MAAM,KAAA,qCAa3E;AAED,OAAO,EAAC,gBAAgB,IAAI,iBAAiB,EAAC,CAAC"}
|
|
@@ -61,5 +61,9 @@ declare type MapInstantiationFormats = Record<Format, {
|
|
|
61
61
|
* Simple encode parameter
|
|
62
62
|
*/
|
|
63
63
|
export declare function encodeParameter(name: string, value: string | boolean | number): string;
|
|
64
|
+
export declare type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
|
|
65
|
+
export declare type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
66
|
+
export declare type PositionalQueryParameter = QueryParameterValue[];
|
|
67
|
+
export declare type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
64
68
|
export {};
|
|
65
69
|
//# sourceMappingURL=maps-api-common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maps-api-common.d.ts","sourceRoot":"","sources":["../../src/api/maps-api-common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,WAAW,CAAC;AACtD,eAAO,MAAM,+BAA+B,aAAa,CAAC;AAE1D,oBAAY,QAAQ,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AACX,oBAAY,UAAU,GAAG,QAAQ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AG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CACF,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAEtF;AAED,oBAAY,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAC;AAElG,oBAAY,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEtE,oBAAY,wBAAwB,GAAG,mBAAmB,EAAE,CAAC;AAE7D,oBAAY,eAAe,GAAG,mBAAmB,GAAG,wBAAwB,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Maps API Client for Carto 3
|
|
3
3
|
*/
|
|
4
4
|
import { CloudNativeCredentials } from '../config';
|
|
5
|
-
import { Format, MapInstantiation, MapType, SchemaField, TileFormat } from './maps-api-common';
|
|
5
|
+
import { Format, MapInstantiation, MapType, QueryParameters, SchemaField, TileFormat } from './maps-api-common';
|
|
6
|
+
export declare type Headers = Record<string, string>;
|
|
6
7
|
declare type FetchLayerDataParams = {
|
|
7
8
|
type: MapType;
|
|
8
9
|
source: string;
|
|
@@ -13,20 +14,23 @@ declare type FetchLayerDataParams = {
|
|
|
13
14
|
clientId?: string;
|
|
14
15
|
format?: Format;
|
|
15
16
|
formatTiles?: TileFormat;
|
|
17
|
+
headers?: Headers;
|
|
16
18
|
aggregationExp?: string;
|
|
17
19
|
aggregationResLevel?: number;
|
|
20
|
+
queryParameters?: QueryParameters;
|
|
18
21
|
};
|
|
19
|
-
export declare function mapInstantiation({ type, source, connection, credentials, geoColumn, columns, clientId, aggregationExp, aggregationResLevel }: FetchLayerDataParams): Promise<MapInstantiation>;
|
|
22
|
+
export declare function mapInstantiation({ type, source, connection, credentials, geoColumn, columns, clientId, headers, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<MapInstantiation>;
|
|
20
23
|
export interface FetchLayerDataResult {
|
|
21
24
|
data: any;
|
|
22
25
|
format?: Format;
|
|
23
26
|
schema: SchemaField[];
|
|
24
27
|
}
|
|
25
|
-
export declare function fetchLayerData({ type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, aggregationExp, aggregationResLevel }: FetchLayerDataParams): Promise<FetchLayerDataResult>;
|
|
26
|
-
export declare function fetchMap({ cartoMapId, clientId, credentials, autoRefresh, onNewData }: {
|
|
28
|
+
export declare function fetchLayerData({ type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<FetchLayerDataResult>;
|
|
29
|
+
export declare function fetchMap({ cartoMapId, clientId, credentials, headers, autoRefresh, onNewData }: {
|
|
27
30
|
cartoMapId: string;
|
|
28
31
|
clientId: string;
|
|
29
32
|
credentials?: CloudNativeCredentials;
|
|
33
|
+
headers?: Headers;
|
|
30
34
|
autoRefresh?: number;
|
|
31
35
|
onNewData?: (map: any) => void;
|
|
32
36
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maps-v3-client.d.ts","sourceRoot":"","sources":["../../src/api/maps-v3-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"maps-v3-client.d.ts","sourceRoot":"","sources":["../../src/api/maps-v3-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAIL,sBAAsB,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAIL,MAAM,EAGN,gBAAgB,EAChB,OAAO,EAEP,eAAe,EACf,WAAW,EACX,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAQ3B,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AA4F7C,aAAK,oBAAoB,GAAG;IAC1B,IAAI,EAA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sBAAsB,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;4BA8B6B,IAAI;;;;;;;;;GAiCjC"}
|
package/typed/config.d.ts
CHANGED
|
@@ -22,5 +22,7 @@ export interface CloudNativeCredentials {
|
|
|
22
22
|
export declare type Credentials = ClassicCredentials | CloudNativeCredentials;
|
|
23
23
|
export declare function setDefaultCredentials({ apiVersion, ...rest }: Partial<Credentials>): void;
|
|
24
24
|
export declare function getDefaultCredentials(): Credentials;
|
|
25
|
+
export declare type V3Endpoint = 'maps' | 'stats';
|
|
25
26
|
export declare function buildMapsUrlFromBase(apiBaseUrl: string): string;
|
|
27
|
+
export declare function buildStatsUrlFromBase(apiBaseUrl: string): string;
|
|
26
28
|
//# sourceMappingURL=config.d.ts.map
|
package/typed/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAC;AAEX,eAAO,MAAM,6BAA6B;;CAEhC,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,WAAW,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAKtE,wBAAgB,qBAAqB,CAAC,EAAC,UAAU,EAAE,GAAG,IAAI,EAAC,EAAE,OAAO,CAAC,WAAW,CAAC,QAchF;AAED,wBAAgB,qBAAqB,IAAI,WAAW,CAEnD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAC;AAEX,eAAO,MAAM,6BAA6B;;CAEhC,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,WAAW,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAKtE,wBAAgB,qBAAqB,CAAC,EAAC,UAAU,EAAE,GAAG,IAAI,EAAC,EAAE,OAAO,CAAC,WAAW,CAAC,QAchF;AAED,wBAAgB,qBAAqB,IAAI,WAAW,CAEnD;AAED,oBAAY,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAW1C,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/typed/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export { default as colorBins } from './style/color-bins-style';
|
|
|
9
9
|
export { default as colorCategories } from './style/color-categories-style';
|
|
10
10
|
export { default as colorContinuous } from './style/color-continuous-style';
|
|
11
11
|
export { FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, getDataV2 as _getDataV2, mapInstantiation as _mapInstantiation } from './api';
|
|
12
|
+
export type { QueryParameters } from './api';
|
|
12
13
|
export type { CartoLayerProps } from './layers/carto-layer';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/typed/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,aAAa,IAAI,cAAc,EAC/B,WAAW,IAAI,YAAY,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,IAAI,UAAU,EACvB,gBAAgB,IAAI,iBAAiB,EACtC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,aAAa,IAAI,cAAc,EAC/B,WAAW,IAAI,YAAY,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,IAAI,UAAU,EACvB,gBAAgB,IAAI,iBAAiB,EACtC,MAAM,OAAO,CAAC;AACf,YAAY,EAAC,eAAe,EAAC,MAAM,OAAO,CAAC;AAC3C,YAAY,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CompositeLayer,
|
|
2
|
-
import { MapType, TileFormat } from '../api/maps-api-common';
|
|
1
|
+
import { CompositeLayer, CompositeLayerProps, Layer, LayerProps, UpdateParameters } from '@deck.gl/core/typed';
|
|
2
|
+
import { MapType, TileFormat, QueryParameters } from '../api/maps-api-common';
|
|
3
3
|
import { Credentials } from '../config';
|
|
4
|
+
import { Headers } from '../api/maps-v3-client';
|
|
4
5
|
/** All properties supported by CartoLayer. */
|
|
5
6
|
export declare type CartoLayerProps<DataT = any> = _CartoLayerProps & CompositeLayerProps<DataT>;
|
|
6
7
|
/** Properties added by CartoLayer. */
|
|
@@ -67,10 +68,14 @@ declare type _CartoLayerProps = {
|
|
|
67
68
|
*/
|
|
68
69
|
onDataError?: (err: unknown) => void;
|
|
69
70
|
clientId?: string;
|
|
71
|
+
/** Custom headers to include in the map instantiation request **/
|
|
72
|
+
headers?: Headers;
|
|
70
73
|
/** Aggregation SQL expression. Only used for spatial index datasets **/
|
|
71
74
|
aggregationExp?: string;
|
|
72
75
|
/** Aggregation resolution level. Only used for spatial index datasets, defaults to 6 for quadbins, 4 for h3. **/
|
|
73
76
|
aggregationResLevel?: number;
|
|
77
|
+
/** Query parameters to be sent to the server. **/
|
|
78
|
+
queryParameters?: QueryParameters;
|
|
74
79
|
};
|
|
75
80
|
export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<Required<_CartoLayerProps> & ExtraProps> {
|
|
76
81
|
static layerName: string;
|
|
@@ -78,12 +83,7 @@ export default class CartoLayer<ExtraProps = {}> extends CompositeLayer<Required
|
|
|
78
83
|
initializeState(): void;
|
|
79
84
|
get isLoaded(): boolean;
|
|
80
85
|
_checkProps(props: CartoLayerProps): void;
|
|
81
|
-
updateState({ props, oldProps, changeFlags }:
|
|
82
|
-
props: CartoLayerProps;
|
|
83
|
-
oldProps: CartoLayerProps;
|
|
84
|
-
context: any;
|
|
85
|
-
changeFlags: ChangeFlags;
|
|
86
|
-
}): void;
|
|
86
|
+
updateState({ props, oldProps, changeFlags }: UpdateParameters<this>): void;
|
|
87
87
|
_updateData(): Promise<void>;
|
|
88
88
|
_getSubLayerAndProps(): [any, LayerProps];
|
|
89
89
|
renderLayers(): Layer | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carto-layer.d.ts","sourceRoot":"","sources":["../../src/layers/carto-layer.ts"],"names":[],"mappings":"AAAA,O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,kDAAkD;IAClD,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,UAAU,GAAG,EAAE,CAAE,SAAQ,cAAc,CACrE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,UAAU,CACxC;IACC,MAAM,CAAC,SAAS,SAAgB;IAChC,MAAM,CAAC,YAAY,MAAuB;IAE1C,eAAe,IAAI,IAAI;IAOvB,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAuCzC,WAAW,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAqB5D,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAsClC,oBAAoB,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC;IAuBzC,YAAY,IAAI,KAAK,GAAG,IAAI;CAqB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carto-tile-layer.d.ts","sourceRoot":"","sources":["../../src/layers/carto-tile-layer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EAET,aAAa,EACb,cAAc,IAAI,aAAa,EAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAC,UAAU,EAAe,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"carto-tile-layer.d.ts","sourceRoot":"","sources":["../../src/layers/carto-tile-layer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,eAAe,CAAC;AAEhD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EAET,aAA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