@deck.gl/carto 8.8.10 → 8.8.12

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/carto",
3
3
  "description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
4
4
  "license": "MIT",
5
- "version": "8.8.10",
5
+ "version": "8.8.12",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -61,5 +61,5 @@
61
61
  "@deck.gl/layers": "^8.0.0",
62
62
  "@loaders.gl/core": "^3.0.0"
63
63
  },
64
- "gitHead": "102716bbb1ff42eeb131ab9280d2d886602d1e6f"
64
+ "gitHead": "72ebfb12e6d82151e480fa479bcf076512f5b593"
65
65
  }
@@ -13,7 +13,7 @@ import {
13
13
  import {format as d3Format} from 'd3-format';
14
14
  import moment from 'moment-timezone';
15
15
 
16
- import {Layer, _ConstructorOf as ConstructorOf} from '@deck.gl/core';
16
+ import {Accessor, Layer, _ConstructorOf as ConstructorOf} from '@deck.gl/core';
17
17
  import {CPUGridLayer, HeatmapLayer, HexagonLayer} from '@deck.gl/aggregation-layers';
18
18
  import {GeoJsonLayer} from '@deck.gl/layers';
19
19
  import {H3HexagonLayer, MVTLayer} from '@deck.gl/geo-layers';
@@ -23,6 +23,15 @@ import H3TileLayer from '../layers/h3-tile-layer';
23
23
  import QuadbinTileLayer from '../layers/quadbin-tile-layer';
24
24
  import {TILE_FORMATS} from './maps-api-common';
25
25
  import {assert} from '../utils';
26
+ import {
27
+ CustomMarkersRange,
28
+ MapDataset,
29
+ MapTextSubLayerConfig,
30
+ TextLabel,
31
+ VisConfig,
32
+ VisualChannelField,
33
+ VisualChannels
34
+ } from './types';
26
35
 
27
36
  const SCALE_FUNCS = {
28
37
  linear: scaleLinear,
@@ -36,6 +45,10 @@ const SCALE_FUNCS = {
36
45
  };
37
46
  export type SCALE_TYPE = keyof typeof SCALE_FUNCS;
38
47
 
48
+ function identity<T>(v: T): T {
49
+ return v;
50
+ }
51
+
39
52
  const UNKNOWN_COLOR = '#868d91';
40
53
 
41
54
  export const AGGREGATION = {
@@ -88,6 +101,13 @@ const sharedPropMap = {
88
101
  }
89
102
  };
90
103
 
104
+ const customMarkersPropsMap = {
105
+ color: 'getIconColor',
106
+ visConfig: {
107
+ radius: 'getIconSize'
108
+ }
109
+ };
110
+
91
111
  const aggregationVisConfig = {
92
112
  colorAggregation: x => ({colorAggregation: AGGREGATION[x] || AGGREGATION.sum}),
93
113
  colorRange: x => ({colorRange: x.colors.map(hexToRGBA)}),
@@ -110,11 +130,16 @@ function mergePropMaps(a: Record<string, any> = {}, b: Record<string, any> = {})
110
130
 
111
131
  export function getLayer(
112
132
  type: string,
113
- config,
114
- dataset
133
+ config: MapTextSubLayerConfig,
134
+ dataset: MapDataset
115
135
  ): {Layer: ConstructorOf<Layer>; propMap: any; defaultProps: any} {
136
+ let basePropMap: any = sharedPropMap;
137
+
138
+ if (config.visConfig?.customMarkers && !config.textLabel) {
139
+ basePropMap = mergePropMaps(sharedPropMap, customMarkersPropsMap);
140
+ }
116
141
  if (type === 'mvt' || type === 'tileset' || type === 'h3' || type === 'quadbin') {
117
- return getTileLayer(dataset);
142
+ return getTileLayer(dataset, basePropMap);
118
143
  }
119
144
 
120
145
  const geoColumn = dataset?.geoColumn;
@@ -160,7 +185,7 @@ export function getLayer(
160
185
  assert(layer, `Unsupported layer type: ${type}`);
161
186
  return {
162
187
  ...layer,
163
- propMap: mergePropMaps(sharedPropMap, layer.propMap),
188
+ propMap: mergePropMaps(basePropMap, layer.propMap),
164
189
  defaultProps: {...defaultProps, ...layer.defaultProps}
165
190
  };
166
191
  }
@@ -183,7 +208,7 @@ export function layerFromTileDataset(
183
208
  return CartoTileLayer;
184
209
  }
185
210
 
186
- function getTileLayer(dataset) {
211
+ function getTileLayer(dataset: MapDataset, basePropMap) {
187
212
  const {
188
213
  aggregationExp,
189
214
  aggregationResLevel,
@@ -197,7 +222,7 @@ function getTileLayer(dataset) {
197
222
 
198
223
  return {
199
224
  Layer: layerFromTileDataset(formatTiles, scheme),
200
- propMap: sharedPropMap,
225
+ propMap: basePropMap,
201
226
  defaultProps: {
202
227
  ...defaultProps,
203
228
  ...(aggregationExp && {aggregationExp}),
@@ -225,7 +250,7 @@ function domainFromAttribute(attribute, scaleType: SCALE_TYPE, scaleLength: numb
225
250
  }
226
251
 
227
252
  function domainFromValues(values, scaleType: SCALE_TYPE) {
228
- if (scaleType === 'ordinal') {
253
+ if (scaleType === 'ordinal' || scaleType === 'point') {
229
254
  return groupSort(
230
255
  values,
231
256
  g => -g.length,
@@ -268,7 +293,7 @@ function normalizeAccessor(accessor, data) {
268
293
  return accessor;
269
294
  }
270
295
 
271
- export function opacityToAlpha(opacity) {
296
+ export function opacityToAlpha(opacity?: number) {
272
297
  return opacity !== undefined ? Math.round(255 * Math.pow(opacity, 1 / 2.2)) : 255;
273
298
  }
274
299
 
@@ -339,16 +364,71 @@ export function getColorAccessor(
339
364
  return normalizeAccessor(accessor, data);
340
365
  }
341
366
 
367
+ const FALLBACK_ICON =
368
+ 'data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==';
369
+
370
+ export function getIconUrlAccessor(
371
+ field: VisualChannelField | null | undefined,
372
+ fallbackUrl: string | null | undefined,
373
+ range: CustomMarkersRange | null | undefined,
374
+ maxIconSize: number,
375
+ data: any
376
+ ) {
377
+ const urlToUnpackedIcon = (url: string) => ({
378
+ id: `${url}@@${maxIconSize}`,
379
+ url,
380
+ width: maxIconSize,
381
+ height: maxIconSize,
382
+ mask: true
383
+ });
384
+ let unknownValue = fallbackUrl || FALLBACK_ICON;
385
+
386
+ if (range?.othersMarker) {
387
+ unknownValue = range.othersMarker;
388
+ }
389
+
390
+ const unknownIcon = urlToUnpackedIcon(unknownValue);
391
+ if (!range || !field) {
392
+ return () => unknownIcon;
393
+ }
394
+
395
+ const mapping: Record<string, any> = {};
396
+ for (const {value, markerUrl} of range.markerMap) {
397
+ if (markerUrl) {
398
+ mapping[value] = urlToUnpackedIcon(markerUrl);
399
+ }
400
+ }
401
+
402
+ const accessor = properties => {
403
+ const propertyValue = properties[field.name];
404
+ return mapping[propertyValue] || unknownIcon;
405
+ };
406
+ return normalizeAccessor(accessor, data);
407
+ }
408
+
409
+ export function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number {
410
+ const {radiusRange, radius} = visConfig;
411
+ const {radiusField, sizeField} = visualChannels;
412
+ const field = radiusField || sizeField;
413
+ return Math.ceil(radiusRange && field ? radiusRange[1] : radius);
414
+ }
415
+
416
+ export function negateAccessor<T>(accessor: Accessor<T, number>): Accessor<T, number> {
417
+ return typeof accessor === 'function' ? (d, i) => -accessor(d, i) : -accessor;
418
+ }
419
+
342
420
  export function getSizeAccessor(
343
421
  {name},
344
- scaleType: SCALE_TYPE,
422
+ scaleType: SCALE_TYPE | undefined,
345
423
  aggregation,
346
- range: Iterable<Range>,
424
+ range: Iterable<Range> | undefined,
347
425
  data: any
348
426
  ) {
349
- const scale = SCALE_FUNCS[scaleType as any]();
350
- scale.domain(calculateDomain(data, name, scaleType));
351
- scale.range(range);
427
+ const scale = scaleType ? SCALE_FUNCS[scaleType as any]() : identity;
428
+ if (scaleType) {
429
+ scale.domain(calculateDomain(data, name, scaleType));
430
+ scale.range(range);
431
+ }
352
432
 
353
433
  let accessorKeys = getAccessorKeys(name, aggregation);
354
434
  const accessor = properties => {
@@ -369,7 +449,7 @@ const FORMATS: Record<string, (value: any) => string> = {
369
449
  default: String
370
450
  };
371
451
 
372
- export function getTextAccessor({name, type}, data) {
452
+ export function getTextAccessor({name, type}: VisualChannelField, data) {
373
453
  const format = FORMATS[type] || FORMATS.default;
374
454
  const accessor = properties => {
375
455
  return format(properties[name]);
@@ -377,13 +457,19 @@ export function getTextAccessor({name, type}, data) {
377
457
  return normalizeAccessor(accessor, data);
378
458
  }
379
459
 
380
- export function getTextPixelOffsetAccessor({alignment, anchor, size}, radius) {
460
+ export function getTextPixelOffsetAccessor(
461
+ {alignment, anchor, size}: TextLabel,
462
+ radius
463
+ ): Accessor<unknown, [number, number]> {
381
464
  const padding = 20;
382
465
  const signX = anchor === 'middle' ? 0 : anchor === 'start' ? 1 : -1;
383
466
  const signY = alignment === 'center' ? 0 : alignment === 'bottom' ? 1 : -1;
384
467
  const sizeOffset = alignment === 'center' ? 0 : size;
385
468
 
386
- const calculateOffset = r => [signX * (r + padding), signY * (r + padding + sizeOffset)];
469
+ const calculateOffset = (r: number): [number, number] => [
470
+ signX * (r + padding),
471
+ signY * (r + padding + sizeOffset)
472
+ ];
387
473
 
388
474
  return typeof radius === 'function'
389
475
  ? d => {
@@ -8,10 +8,14 @@ import {
8
8
  getTextAccessor,
9
9
  getTextPixelOffsetAccessor,
10
10
  OPACITY_MAP,
11
- opacityToAlpha
11
+ opacityToAlpha,
12
+ getIconUrlAccessor,
13
+ negateAccessor,
14
+ getMaxMarkerSize
12
15
  } from './layer-map';
13
16
  import {_flatten as flatten, log} from '@deck.gl/core';
14
17
  import {assert} from '../utils';
18
+ import {MapDataset, MapTextSubLayerConfig, VisualChannels} from './types';
15
19
 
16
20
  export function parseMap(json) {
17
21
  const {keplerMapConfig, datasets} = json;
@@ -30,7 +34,7 @@ export function parseMap(json) {
30
34
  layers: extractTextLayers(layers.reverse()).map(({id, type, config, visualChannels}) => {
31
35
  try {
32
36
  const {dataId} = config;
33
- const dataset = datasets.find(d => d.id === dataId);
37
+ const dataset: MapDataset | null = datasets.find(d => d.id === dataId);
34
38
  assert(dataset, `No dataset matching dataId: ${dataId}`);
35
39
  const {data} = dataset;
36
40
  assert(data, `No data loaded for dataId: ${dataId}`);
@@ -128,7 +132,7 @@ function mapProps(source, target, mapping) {
128
132
  }
129
133
  }
130
134
 
131
- function createStyleProps(config, mapping) {
135
+ function createStyleProps(config: MapTextSubLayerConfig, mapping) {
132
136
  const result: Record<string, any> = {};
133
137
  mapProps(config, result, mapping);
134
138
 
@@ -153,9 +157,22 @@ function createStyleProps(config, mapping) {
153
157
  }
154
158
 
155
159
  /* eslint-disable complexity, max-statements */
156
- function createChannelProps(visualChannels, type, config, data) {
157
- const {colorField, colorScale, sizeField, sizeScale, strokeColorField, strokeColorScale} =
158
- visualChannels;
160
+ function createChannelProps(
161
+ visualChannels: VisualChannels,
162
+ type: string,
163
+ config: MapTextSubLayerConfig,
164
+ data
165
+ ) {
166
+ const {
167
+ colorField,
168
+ colorScale,
169
+ radiusField,
170
+ radiusScale,
171
+ sizeField,
172
+ sizeScale,
173
+ strokeColorField,
174
+ strokeColorScale
175
+ } = visualChannels;
159
176
  let {heightField, heightScale} = visualChannels;
160
177
  if (type === 'hexagonId') {
161
178
  heightField = sizeField;
@@ -179,6 +196,7 @@ function createChannelProps(visualChannels, type, config, data) {
179
196
  const {colorAggregation: aggregation, colorRange: range} = visConfig;
180
197
  result.getFillColor = getColorAccessor(
181
198
  colorField,
199
+ // @ts-ignore
182
200
  colorScale,
183
201
  {aggregation, range},
184
202
  visConfig.opacity,
@@ -186,6 +204,18 @@ function createChannelProps(visualChannels, type, config, data) {
186
204
  );
187
205
  }
188
206
 
207
+ if (radiusField || sizeField) {
208
+ result.getPointRadius = getSizeAccessor(
209
+ // @ts-ignore
210
+ radiusField || sizeField,
211
+ // @ts-ignore
212
+ radiusScale || sizeScale,
213
+ visConfig.sizeAggregation,
214
+ visConfig.radiusRange || visConfig.sizeRange,
215
+ data
216
+ );
217
+ }
218
+
189
219
  if (strokeColorField) {
190
220
  const fallbackOpacity = type === 'point' ? visConfig.opacity : 1;
191
221
  const opacity =
@@ -193,35 +223,70 @@ function createChannelProps(visualChannels, type, config, data) {
193
223
  const {strokeColorAggregation: aggregation, strokeColorRange: range} = visConfig;
194
224
  result.getLineColor = getColorAccessor(
195
225
  strokeColorField,
226
+ // @ts-ignore
196
227
  strokeColorScale,
228
+ // @ts-ignore
197
229
  {aggregation, range},
198
230
  opacity,
199
231
  data
200
232
  );
201
233
  }
234
+
202
235
  if (heightField) {
203
236
  result.getElevation = getSizeAccessor(
204
237
  heightField,
238
+ // @ts-ignore
205
239
  heightScale,
206
240
  visConfig.heightAggregation,
207
241
  visConfig.heightRange || visConfig.sizeRange,
208
242
  data
209
243
  );
210
244
  }
211
- if (sizeField) {
212
- result.getPointRadius = getSizeAccessor(
213
- sizeField,
214
- sizeScale,
215
- visConfig.sizeAggregation,
216
- visConfig.radiusRange || visConfig.sizeRange,
217
- data
218
- );
219
- }
245
+
220
246
  if (textLabelField) {
221
247
  result.getText = getTextAccessor(textLabelField, data);
222
248
  result.pointType = 'text';
223
249
  const radius = result.getPointRadius || visConfig.radius;
224
250
  result.getTextPixelOffset = getTextPixelOffsetAccessor(textLabel, radius);
251
+ } else if (visConfig.customMarkers) {
252
+ const maxIconSize = getMaxMarkerSize(visConfig, visualChannels);
253
+ const {getPointRadius, getFillColor} = result;
254
+ result.pointType = 'icon';
255
+ result.getIcon = getIconUrlAccessor(
256
+ visualChannels.customMarkersField,
257
+ visConfig.customMarkersUrl,
258
+ visConfig.customMarkersRange,
259
+ maxIconSize,
260
+ data
261
+ );
262
+ result._subLayerProps = {
263
+ 'points-icon': {
264
+ loadOptions: {
265
+ image: {
266
+ type: 'imagebitmap'
267
+ },
268
+ imagebitmap: {
269
+ resizeWidth: maxIconSize,
270
+ resizeHeight: maxIconSize,
271
+ resizeQuality: 'high'
272
+ }
273
+ }
274
+ }
275
+ };
276
+
277
+ if (getFillColor) {
278
+ result.getIconColor = getFillColor;
279
+ }
280
+
281
+ if (getPointRadius) {
282
+ result.getIconSize = getPointRadius;
283
+ }
284
+
285
+ if (visualChannels.rotationField) {
286
+ result.getIconAngle = negateAccessor(
287
+ getSizeAccessor(visualChannels.rotationField, undefined, null, undefined, data)
288
+ );
289
+ }
225
290
  }
226
291
 
227
292
  return result;
@@ -0,0 +1,108 @@
1
+ import {SCALE_TYPE} from './layer-map';
2
+
3
+ export type VisualChannelField = {
4
+ name: string;
5
+ type: string;
6
+ };
7
+
8
+ export type VisualChannels = {
9
+ colorField?: VisualChannelField;
10
+ colorScale?: SCALE_TYPE;
11
+
12
+ customMarkersField?: VisualChannelField;
13
+ customMarkersScale?: SCALE_TYPE;
14
+
15
+ radiusField?: VisualChannelField;
16
+ radiusScale?: SCALE_TYPE;
17
+
18
+ rotationScale?: SCALE_TYPE;
19
+ rotationField?: VisualChannelField;
20
+
21
+ sizeField?: VisualChannelField;
22
+ sizeScale?: SCALE_TYPE;
23
+
24
+ strokeColorField?: VisualChannelField;
25
+ strokeColorScale?: SCALE_TYPE;
26
+
27
+ heightField?: VisualChannelField;
28
+ heightScale?: SCALE_TYPE;
29
+ };
30
+
31
+ export type ColorRange = {
32
+ category: string;
33
+ colors: string[];
34
+ colorMap: string[][] | undefined;
35
+ name: string;
36
+ type: string;
37
+ };
38
+
39
+ export type CustomMarkersRange = {
40
+ markerMap: {
41
+ value: string;
42
+ markerUrl?: string;
43
+ }[];
44
+ othersMarker?: string;
45
+ };
46
+
47
+ export type VisConfig = {
48
+ filled?: boolean;
49
+ opacity?: number;
50
+ enable3d?: boolean;
51
+
52
+ colorAggregation?: any;
53
+ colorRange: ColorRange;
54
+
55
+ customMarkers?: boolean;
56
+ customMarkersRange?: CustomMarkersRange | null;
57
+ customMarkersUrl?: string | null;
58
+
59
+ radius: number;
60
+ radiusRange?: number[];
61
+
62
+ sizeAggregation?: any;
63
+ sizeRange?: any;
64
+
65
+ strokeColorAggregation?: any;
66
+ strokeOpacity?: number;
67
+ strokeColorRange?: ColorRange;
68
+
69
+ heightRange?: any;
70
+ heightAggregation?: any;
71
+ };
72
+
73
+ export type TextLabel = {
74
+ field: VisualChannelField | null | undefined;
75
+ alignment?: 'center' | 'bottom' | 'top';
76
+ anchor?: 'middle' | 'start' | 'end';
77
+ size: number;
78
+ color?: number[];
79
+ offset?: [number, number];
80
+ };
81
+
82
+ export type MapLayerConfig = {
83
+ columns?: Record<string, any>;
84
+ color?: number[];
85
+ label?: string;
86
+ dataId: string;
87
+ textLabel: TextLabel[];
88
+ visConfig: VisConfig;
89
+ };
90
+
91
+ export type MapTextSubLayerConfig = Omit<MapLayerConfig, 'textLabel'> & {
92
+ textLabel?: TextLabel;
93
+ };
94
+
95
+ export type MapConfigLayer = {
96
+ type: string;
97
+ id: string;
98
+ config: MapLayerConfig;
99
+ visualChannels: VisualChannels;
100
+ };
101
+
102
+ export type MapDataset = {
103
+ id: string;
104
+ data: any;
105
+ aggregationExp: string | null;
106
+ aggregationResLevel: number | null;
107
+ geoColumn: string;
108
+ };
@@ -1,9 +1,10 @@
1
1
  import { scaleLinear, scaleOrdinal, scaleLog, scalePoint, scaleQuantile, scaleQuantize, scaleSqrt, scaleThreshold } from 'd3-scale';
2
- import { Layer, _ConstructorOf as ConstructorOf } from '@deck.gl/core/typed';
2
+ import { Accessor, Layer, _ConstructorOf as ConstructorOf } from '@deck.gl/core/typed';
3
3
  import { MVTLayer } from '@deck.gl/geo-layers/typed';
4
4
  import CartoTileLayer from '../layers/carto-tile-layer';
5
5
  import H3TileLayer from '../layers/h3-tile-layer';
6
6
  import QuadbinTileLayer from '../layers/quadbin-tile-layer';
7
+ import { CustomMarkersRange, MapDataset, MapTextSubLayerConfig, TextLabel, VisConfig, VisualChannelField, VisualChannels } from './types';
7
8
  declare const SCALE_FUNCS: {
8
9
  linear: typeof scaleLinear;
9
10
  ordinal: typeof scaleOrdinal;
@@ -26,14 +27,14 @@ export declare const OPACITY_MAP: {
26
27
  getLineColor: string;
27
28
  getTextColor: string;
28
29
  };
29
- export declare function getLayer(type: string, config: any, dataset: any): {
30
+ export declare function getLayer(type: string, config: MapTextSubLayerConfig, dataset: MapDataset): {
30
31
  Layer: ConstructorOf<Layer>;
31
32
  propMap: any;
32
33
  defaultProps: any;
33
34
  };
34
35
  export declare function layerFromTileDataset(formatTiles: string | null | undefined, scheme: string): typeof CartoTileLayer | typeof H3TileLayer | typeof MVTLayer | typeof QuadbinTileLayer;
35
36
  declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
36
- export declare function opacityToAlpha(opacity: any): number;
37
+ export declare function opacityToAlpha(opacity?: number): number;
37
38
  export declare function getColorValueAccessor({ name }: {
38
39
  name: any;
39
40
  }, colorAggregation: any, data: any): any;
@@ -46,17 +47,13 @@ export declare function getColorAccessor({ name }: {
46
47
  colorMap: any;
47
48
  };
48
49
  }, opacity: number | undefined, data: any): any;
50
+ export declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, fallbackUrl: string | null | undefined, range: CustomMarkersRange | null | undefined, maxIconSize: number, data: any): any;
51
+ export declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
52
+ export declare function negateAccessor<T>(accessor: Accessor<T, number>): Accessor<T, number>;
49
53
  export declare function getSizeAccessor({ name }: {
50
54
  name: any;
51
- }, scaleType: SCALE_TYPE, aggregation: any, range: Iterable<Range>, data: any): any;
52
- export declare function getTextAccessor({ name, type }: {
53
- name: any;
54
- type: any;
55
- }, data: any): any;
56
- export declare function getTextPixelOffsetAccessor({ alignment, anchor, size }: {
57
- alignment: any;
58
- anchor: any;
59
- size: any;
60
- }, radius: any): number[] | ((d: any) => number[]);
55
+ }, scaleType: SCALE_TYPE | undefined, aggregation: any, range: Iterable<Range> | undefined, data: any): any;
56
+ export declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
57
+ export declare function getTextPixelOffsetAccessor({ alignment, anchor, size }: TextLabel, radius: any): Accessor<unknown, [number, number]>;
61
58
  export { domainFromValues as _domainFromValues };
62
59
  //# sourceMappingURL=layer-map.d.ts.map
@@ -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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AE,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAEpF;AAED,wBAAgB,eAAe,CAC7B,EAAC,IAAI,EAAC;;CAAA,EACN,SAAS,EAAE,UAAU,GAAG,SAAS,EACjC,WAAW,KAAA,EACX,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,SAAS,EAClC,IAAI,EAAE,GAAG,OAiBV;AAUD,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,kBAAkB,EAAE,IAAI,KAAA,OAMrE;AAED,wBAAgB,0BAA0B,CACxC,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC,EAAE,SAAS,EACpC,MAAM,KAAA,GACL,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBrC;AAED,OAAO,EAAC,gBAAgB,IAAI,iBAAiB,EAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseMap.d.ts","sourceRoot":"","sources":["../../src/api/parseMap.ts"],"names":[],"mappings":"AAeA,wBAAgB,QAAQ,CAAC,IAAI,KAAA;;;;;;;;;EAqC5B"}
1
+ {"version":3,"file":"parseMap.d.ts","sourceRoot":"","sources":["../../src/api/parseMap.ts"],"names":[],"mappings":"AAmBA,wBAAgB,QAAQ,CAAC,IAAI,KAAA;;;;;;;;;EAqC5B"}
@@ -0,0 +1,87 @@
1
+ import { SCALE_TYPE } from './layer-map';
2
+ export declare type VisualChannelField = {
3
+ name: string;
4
+ type: string;
5
+ };
6
+ export declare type VisualChannels = {
7
+ colorField?: VisualChannelField;
8
+ colorScale?: SCALE_TYPE;
9
+ customMarkersField?: VisualChannelField;
10
+ customMarkersScale?: SCALE_TYPE;
11
+ radiusField?: VisualChannelField;
12
+ radiusScale?: SCALE_TYPE;
13
+ rotationScale?: SCALE_TYPE;
14
+ rotationField?: VisualChannelField;
15
+ sizeField?: VisualChannelField;
16
+ sizeScale?: SCALE_TYPE;
17
+ strokeColorField?: VisualChannelField;
18
+ strokeColorScale?: SCALE_TYPE;
19
+ heightField?: VisualChannelField;
20
+ heightScale?: SCALE_TYPE;
21
+ };
22
+ export declare type ColorRange = {
23
+ category: string;
24
+ colors: string[];
25
+ colorMap: string[][] | undefined;
26
+ name: string;
27
+ type: string;
28
+ };
29
+ export declare type CustomMarkersRange = {
30
+ markerMap: {
31
+ value: string;
32
+ markerUrl?: string;
33
+ }[];
34
+ othersMarker?: string;
35
+ };
36
+ export declare type VisConfig = {
37
+ filled?: boolean;
38
+ opacity?: number;
39
+ enable3d?: boolean;
40
+ colorAggregation?: any;
41
+ colorRange: ColorRange;
42
+ customMarkers?: boolean;
43
+ customMarkersRange?: CustomMarkersRange | null;
44
+ customMarkersUrl?: string | null;
45
+ radius: number;
46
+ radiusRange?: number[];
47
+ sizeAggregation?: any;
48
+ sizeRange?: any;
49
+ strokeColorAggregation?: any;
50
+ strokeOpacity?: number;
51
+ strokeColorRange?: ColorRange;
52
+ heightRange?: any;
53
+ heightAggregation?: any;
54
+ };
55
+ export declare type TextLabel = {
56
+ field: VisualChannelField | null | undefined;
57
+ alignment?: 'center' | 'bottom' | 'top';
58
+ anchor?: 'middle' | 'start' | 'end';
59
+ size: number;
60
+ color?: number[];
61
+ offset?: [number, number];
62
+ };
63
+ export declare type MapLayerConfig = {
64
+ columns?: Record<string, any>;
65
+ color?: number[];
66
+ label?: string;
67
+ dataId: string;
68
+ textLabel: TextLabel[];
69
+ visConfig: VisConfig;
70
+ };
71
+ export declare type MapTextSubLayerConfig = Omit<MapLayerConfig, 'textLabel'> & {
72
+ textLabel?: TextLabel;
73
+ };
74
+ export declare type MapConfigLayer = {
75
+ type: string;
76
+ id: string;
77
+ config: MapLayerConfig;
78
+ visualChannels: VisualChannels;
79
+ };
80
+ export declare type MapDataset = {
81
+ id: string;
82
+ data: any;
83
+ aggregationExp: string | null;
84
+ aggregationResLevel: number | null;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