@carto/api-client 0.4.3 → 0.4.5-alpha.0

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.
@@ -4,12 +4,6 @@ var union = require('@turf/union');
4
4
  var invariant = require('@turf/invariant');
5
5
  var helpers = require('@turf/helpers');
6
6
 
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var bboxClip__default = /*#__PURE__*/_interopDefaultLegacy(bboxClip);
10
- var bboxPolygon__default = /*#__PURE__*/_interopDefaultLegacy(bboxPolygon);
11
- var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
12
-
13
7
  /**
14
8
  * @internal
15
9
  * @internalRemarks Source: @carto/react-core, @carto/constants, @deck.gl/carto
@@ -245,7 +239,7 @@ function createViewportSpatialFilter(viewport) {
245
239
  if (_isGlobalViewport(viewport)) {
246
240
  return;
247
241
  }
248
- return createPolygonSpatialFilter(bboxPolygon__default["default"](viewport).geometry);
242
+ return createPolygonSpatialFilter(bboxPolygon(viewport).geometry);
249
243
  }
250
244
  /**
251
245
  * Returns a {@link SpatialFilter} for a given {@link Polygon} or
@@ -277,23 +271,23 @@ function _isGlobalViewport(viewport) {
277
271
  */
278
272
  function _normalizeGeometry(geometry) {
279
273
  const WORLD = [-180, -90, +180, +90];
280
- const worldClip = _clean(bboxClip__default["default"](geometry, WORLD).geometry);
274
+ const worldClip = _clean(bboxClip(geometry, WORLD).geometry);
281
275
  const geometryTxWest = _tx(geometry, 360);
282
276
  const geometryTxEast = _tx(geometry, -360);
283
277
  let result = worldClip;
284
278
  if (result && geometryTxWest) {
285
- const worldWestClip = _clean(bboxClip__default["default"](geometryTxWest, WORLD).geometry);
279
+ const worldWestClip = _clean(bboxClip(geometryTxWest, WORLD).geometry);
286
280
  if (worldWestClip) {
287
281
  const collection = helpers.featureCollection([helpers.feature(result), helpers.feature(worldWestClip)]);
288
- const merged = union__default["default"](collection);
282
+ const merged = union(collection);
289
283
  result = merged ? _clean(merged.geometry) : result;
290
284
  }
291
285
  }
292
286
  if (result && geometryTxEast) {
293
- const worldEastClip = _clean(bboxClip__default["default"](geometryTxEast, WORLD).geometry);
287
+ const worldEastClip = _clean(bboxClip(geometryTxEast, WORLD).geometry);
294
288
  if (worldEastClip) {
295
289
  const collection = helpers.featureCollection([helpers.feature(result), helpers.feature(worldEastClip)]);
296
- const merged = union__default["default"](collection);
290
+ const merged = union(collection);
297
291
  result = merged ? _clean(merged.geometry) : result;
298
292
  }
299
293
  }
@@ -486,6 +480,8 @@ function formatErrorKey(key) {
486
480
  }
487
481
 
488
482
  // deck.gl
483
+ // SPDX-License-Identifier: MIT
484
+ // Copyright (c) vis.gl contributors
489
485
  const requestWithParameters = function (_ref) {
490
486
  let {
491
487
  baseUrl,
@@ -617,6 +613,8 @@ function excludeURLParameters(baseUrlString, parameters) {
617
613
  }
618
614
 
619
615
  // deck.gl
616
+ // SPDX-License-Identifier: MIT
617
+ // Copyright (c) vis.gl contributors
620
618
  const baseSource = function (endpoint, options, urlParameters) {
621
619
  try {
622
620
  const {
@@ -712,6 +710,8 @@ const SOURCE_DEFAULTS = {
712
710
  };
713
711
 
714
712
  // deck.gl
713
+ // SPDX-License-Identifier: MIT
714
+ // Copyright (c) vis.gl contributors
715
715
  const boundaryQuerySource = function (options) {
716
716
  try {
717
717
  const {
@@ -741,6 +741,8 @@ const boundaryQuerySource = function (options) {
741
741
  };
742
742
 
743
743
  // deck.gl
744
+ // SPDX-License-Identifier: MIT
745
+ // Copyright (c) vis.gl contributors
744
746
  const boundaryTableSource = function (options) {
745
747
  try {
746
748
  const {
@@ -893,41 +895,43 @@ function executeModel(props) {
893
895
  data,
894
896
  filters,
895
897
  filtersLogicalOperator = 'and',
896
- geoColumn = DEFAULT_GEO_COLUMN
898
+ spatialDataType = 'geo',
899
+ spatialFiltersMode = 'intersects',
900
+ spatialFiltersResolution = 0
897
901
  } = source;
898
- const queryParameters = source.queryParameters ? JSON.stringify(source.queryParameters) : '';
899
902
  const queryParams = {
900
903
  type,
901
904
  client: clientId,
902
905
  source: data,
903
- params: JSON.stringify(params),
904
- queryParameters,
905
- filters: JSON.stringify(filters),
906
+ params,
907
+ queryParameters: source.queryParameters || '',
908
+ filters,
906
909
  filtersLogicalOperator
907
910
  };
911
+ const spatialDataColumn = source.spatialDataColumn || DEFAULT_GEO_COLUMN;
908
912
  // Picking Model API requires 'spatialDataColumn'.
909
913
  if (model === 'pick') {
910
- queryParams.spatialDataColumn = geoColumn;
914
+ queryParams.spatialDataColumn = spatialDataColumn;
911
915
  }
912
- // API supports multiple filters, we apply it only to geoColumn
916
+ // API supports multiple filters, we apply it only to spatialDataColumn
913
917
  const spatialFilters = source.spatialFilter ? {
914
- [geoColumn]: source.spatialFilter
918
+ [spatialDataColumn]: source.spatialFilter
915
919
  } : undefined;
916
920
  if (spatialFilters) {
917
- queryParams.spatialFilters = JSON.stringify(spatialFilters);
921
+ queryParams.spatialFilters = spatialFilters;
922
+ queryParams.spatialDataColumn = spatialDataColumn;
923
+ queryParams.spatialDataType = spatialDataType;
918
924
  }
919
- const urlWithSearchParams = url + '?' + new URLSearchParams(queryParams).toString();
925
+ if (spatialDataType !== 'geo') {
926
+ if (spatialFiltersResolution > 0) {
927
+ queryParams.spatialFiltersResolution = spatialFiltersResolution;
928
+ }
929
+ queryParams.spatialFiltersMode = spatialFiltersMode;
930
+ }
931
+ const urlWithSearchParams = url + '?' + objectToURLSearchParams(queryParams).toString();
920
932
  const isGet = urlWithSearchParams.length <= REQUEST_GET_MAX_URL_LENGTH;
921
933
  if (isGet) {
922
934
  url = urlWithSearchParams;
923
- } else {
924
- // undo the JSON.stringify, @TODO find a better pattern
925
- queryParams.params = params;
926
- queryParams.filters = filters;
927
- queryParams.queryParameters = source.queryParameters;
928
- if (spatialFilters) {
929
- queryParams.spatialFilters = spatialFilters;
930
- }
931
935
  }
932
936
  return makeCall({
933
937
  url,
@@ -941,6 +945,63 @@ function executeModel(props) {
941
945
  }
942
946
  });
943
947
  }
948
+ function objectToURLSearchParams(object) {
949
+ const params = new URLSearchParams();
950
+ for (const key in object) {
951
+ if (isPureObject(object[key])) {
952
+ params.append(key, JSON.stringify(object[key]));
953
+ } else if (Array.isArray(object[key])) {
954
+ params.append(key, JSON.stringify(object[key]));
955
+ } else if (object[key] === null) {
956
+ params.append(key, 'null');
957
+ } else if (object[key] !== undefined) {
958
+ params.append(key, String(object[key]));
959
+ }
960
+ }
961
+ return params;
962
+ }
963
+
964
+ const DEFAULT_TILE_SIZE = 512;
965
+ const QUADBIN_ZOOM_MAX_OFFSET = 4;
966
+ function getSpatialFiltersResolution(source, viewState) {
967
+ const dataResolution = source.dataResolution ?? Number.MAX_VALUE;
968
+ const aggregationResLevel = source.aggregationResLevel ?? (source.spatialDataType === 'h3' ? DEFAULT_AGGREGATION_RES_LEVEL_H3 : DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN);
969
+ const aggregationResLevelOffset = Math.max(0, Math.floor(aggregationResLevel));
970
+ const currentZoomInt = Math.ceil(viewState.zoom);
971
+ if (source.spatialDataType === 'h3') {
972
+ const tileSize = DEFAULT_TILE_SIZE;
973
+ const maxResolutionForZoom = maxH3SpatialFiltersResolutions.find(_ref => {
974
+ let [zoom] = _ref;
975
+ return zoom === currentZoomInt;
976
+ })?.[1] ?? Math.max(0, currentZoomInt - 3);
977
+ const maxSpatialFiltersResolution = maxResolutionForZoom ? Math.min(dataResolution, maxResolutionForZoom) : dataResolution;
978
+ const hexagonResolution = getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
979
+ return Math.min(hexagonResolution, maxSpatialFiltersResolution);
980
+ }
981
+ if (source.spatialDataType === 'quadbin') {
982
+ const maxResolutionForZoom = currentZoomInt + QUADBIN_ZOOM_MAX_OFFSET;
983
+ const maxSpatialFiltersResolution = Math.min(dataResolution, maxResolutionForZoom);
984
+ const quadsResolution = Math.floor(viewState.zoom) + aggregationResLevelOffset;
985
+ return Math.min(quadsResolution, maxSpatialFiltersResolution);
986
+ }
987
+ return undefined;
988
+ }
989
+ const maxH3SpatialFiltersResolutions = [[20, 14], [19, 13], [18, 12], [17, 11], [16, 10], [15, 9], [14, 8], [13, 7], [12, 7], [11, 7], [10, 6], [9, 6], [8, 5], [7, 4], [6, 4], [5, 3], [4, 2], [3, 1], [2, 1], [1, 0]];
990
+ // stolen from https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
991
+ // Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
992
+ const BIAS = 2;
993
+ // Resolution conversion function. Takes a WebMercatorViewport and returns
994
+ // a H3 resolution such that the screen space size of the hexagons is
995
+ // similar
996
+ function getHexagonResolution(viewport, tileSize) {
997
+ // Difference in given tile size compared to deck's internal 512px tile size,
998
+ // expressed as an offset to the viewport zoom.
999
+ const zoomOffset = Math.log2(tileSize / DEFAULT_TILE_SIZE);
1000
+ const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
1001
+ const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
1002
+ // Clip and bias
1003
+ return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
1004
+ }
944
1005
 
945
1006
  /**
946
1007
  * Source for Widget API requests on a data source defined by a SQL query.
@@ -965,9 +1026,21 @@ class WidgetBaseSource {
965
1026
  connectionName: props.connectionName,
966
1027
  filters: getApplicableFilters(owner, props.filters),
967
1028
  filtersLogicalOperator: props.filtersLogicalOperator,
968
- geoColumn: props.geoColumn
1029
+ spatialDataType: props.spatialDataType,
1030
+ spatialDataColumn: props.spatialDataColumn,
1031
+ dataResolution: props.dataResolution
969
1032
  };
970
1033
  }
1034
+ _getSpatialFiltersResolution(source, spatialFilter, referenceViewState) {
1035
+ // spatialFiltersResolution applies only to spatial index sources.
1036
+ if (!spatialFilter || source.spatialDataType === 'geo') {
1037
+ return;
1038
+ }
1039
+ if (!referenceViewState) {
1040
+ throw new Error('Missing required option, "spatialIndexReferenceViewState".');
1041
+ }
1042
+ return getSpatialFiltersResolution(source, referenceViewState);
1043
+ }
971
1044
  /****************************************************************************
972
1045
  * CATEGORIES
973
1046
  */
@@ -981,6 +1054,8 @@ class WidgetBaseSource {
981
1054
  const {
982
1055
  filterOwner,
983
1056
  spatialFilter,
1057
+ spatialFiltersMode,
1058
+ spatialIndexReferenceViewState,
984
1059
  abortController,
985
1060
  ...params
986
1061
  } = options;
@@ -989,10 +1064,14 @@ class WidgetBaseSource {
989
1064
  operation,
990
1065
  operationColumn
991
1066
  } = params;
1067
+ const source = _this.getModelSource(filterOwner);
1068
+ const spatialFiltersResolution = _this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
992
1069
  return Promise.resolve(executeModel({
993
1070
  model: 'category',
994
1071
  source: {
995
- ..._this.getModelSource(filterOwner),
1072
+ ...source,
1073
+ spatialFiltersResolution,
1074
+ spatialFiltersMode,
996
1075
  spatialFilter
997
1076
  },
998
1077
  params: {
@@ -1025,6 +1104,8 @@ class WidgetBaseSource {
1025
1104
  const {
1026
1105
  filterOwner,
1027
1106
  spatialFilter,
1107
+ spatialFiltersMode,
1108
+ spatialIndexReferenceViewState,
1028
1109
  abortController,
1029
1110
  ...params
1030
1111
  } = options;
@@ -1036,10 +1117,14 @@ class WidgetBaseSource {
1036
1117
  limit,
1037
1118
  tileResolution
1038
1119
  } = params;
1120
+ const source = _this2.getModelSource(filterOwner);
1121
+ const spatialFiltersResolution = _this2._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1039
1122
  return Promise.resolve(executeModel({
1040
1123
  model: 'pick',
1041
1124
  source: {
1042
- ..._this2.getModelSource(filterOwner),
1125
+ ...source,
1126
+ spatialFiltersResolution,
1127
+ spatialFiltersMode,
1043
1128
  spatialFilter
1044
1129
  },
1045
1130
  params: {
@@ -1079,6 +1164,8 @@ class WidgetBaseSource {
1079
1164
  const {
1080
1165
  filterOwner,
1081
1166
  spatialFilter,
1167
+ spatialFiltersMode,
1168
+ spatialIndexReferenceViewState,
1082
1169
  abortController,
1083
1170
  operationExp,
1084
1171
  ...params
@@ -1087,10 +1174,14 @@ class WidgetBaseSource {
1087
1174
  column,
1088
1175
  operation
1089
1176
  } = params;
1177
+ const source = _this3.getModelSource(filterOwner);
1178
+ const spatialFiltersResolution = _this3._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1090
1179
  return Promise.resolve(executeModel({
1091
1180
  model: 'formula',
1092
1181
  source: {
1093
- ..._this3.getModelSource(filterOwner),
1182
+ ...source,
1183
+ spatialFiltersResolution,
1184
+ spatialFiltersMode,
1094
1185
  spatialFilter
1095
1186
  },
1096
1187
  params: {
@@ -1119,6 +1210,8 @@ class WidgetBaseSource {
1119
1210
  const {
1120
1211
  filterOwner,
1121
1212
  spatialFilter,
1213
+ spatialFiltersMode,
1214
+ spatialIndexReferenceViewState,
1122
1215
  abortController,
1123
1216
  ...params
1124
1217
  } = options;
@@ -1127,10 +1220,14 @@ class WidgetBaseSource {
1127
1220
  operation,
1128
1221
  ticks
1129
1222
  } = params;
1223
+ const source = _this4.getModelSource(filterOwner);
1224
+ const spatialFiltersResolution = _this4._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1130
1225
  return Promise.resolve(executeModel({
1131
1226
  model: 'histogram',
1132
1227
  source: {
1133
- ..._this4.getModelSource(filterOwner),
1228
+ ...source,
1229
+ spatialFiltersResolution,
1230
+ spatialFiltersMode,
1134
1231
  spatialFilter
1135
1232
  },
1136
1233
  params: {
@@ -1175,16 +1272,22 @@ class WidgetBaseSource {
1175
1272
  const {
1176
1273
  filterOwner,
1177
1274
  spatialFilter,
1275
+ spatialFiltersMode,
1276
+ spatialIndexReferenceViewState,
1178
1277
  abortController,
1179
1278
  ...params
1180
1279
  } = options;
1181
1280
  const {
1182
1281
  column
1183
1282
  } = params;
1283
+ const source = _this5.getModelSource(filterOwner);
1284
+ const spatialFiltersResolution = _this5._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1184
1285
  return Promise.resolve(executeModel({
1185
1286
  model: 'range',
1186
1287
  source: {
1187
- ..._this5.getModelSource(filterOwner),
1288
+ ...source,
1289
+ spatialFiltersResolution,
1290
+ spatialFiltersMode,
1188
1291
  spatialFilter
1189
1292
  },
1190
1293
  params: {
@@ -1211,6 +1314,8 @@ class WidgetBaseSource {
1211
1314
  const {
1212
1315
  filterOwner,
1213
1316
  spatialFilter,
1317
+ spatialFiltersMode,
1318
+ spatialIndexReferenceViewState,
1214
1319
  abortController,
1215
1320
  ...params
1216
1321
  } = options;
@@ -1220,12 +1325,16 @@ class WidgetBaseSource {
1220
1325
  yAxisColumn,
1221
1326
  yAxisJoinOperation
1222
1327
  } = params;
1328
+ const source = _this6.getModelSource(filterOwner);
1329
+ const spatialFiltersResolution = _this6._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1223
1330
  // Make sure this is sync with the same constant in cloud-native/maps-api
1224
1331
  const HARD_LIMIT = 500;
1225
1332
  return Promise.resolve(executeModel({
1226
1333
  model: 'scatterplot',
1227
1334
  source: {
1228
- ..._this6.getModelSource(filterOwner),
1335
+ ...source,
1336
+ spatialFiltersResolution,
1337
+ spatialFiltersMode,
1229
1338
  spatialFilter
1230
1339
  },
1231
1340
  params: {
@@ -1262,6 +1371,8 @@ class WidgetBaseSource {
1262
1371
  const {
1263
1372
  filterOwner,
1264
1373
  spatialFilter,
1374
+ spatialFiltersMode,
1375
+ spatialIndexReferenceViewState,
1265
1376
  abortController,
1266
1377
  ...params
1267
1378
  } = options;
@@ -1272,10 +1383,14 @@ class WidgetBaseSource {
1272
1383
  offset = 0,
1273
1384
  limit = 10
1274
1385
  } = params;
1386
+ const source = _this7.getModelSource(filterOwner);
1387
+ const spatialFiltersResolution = _this7._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1275
1388
  return Promise.resolve(executeModel({
1276
1389
  model: 'table',
1277
1390
  source: {
1278
- ..._this7.getModelSource(filterOwner),
1391
+ ...source,
1392
+ spatialFiltersResolution,
1393
+ spatialFiltersMode,
1279
1394
  spatialFilter
1280
1395
  },
1281
1396
  params: {
@@ -1311,6 +1426,8 @@ class WidgetBaseSource {
1311
1426
  filterOwner,
1312
1427
  abortController,
1313
1428
  spatialFilter,
1429
+ spatialFiltersMode,
1430
+ spatialIndexReferenceViewState,
1314
1431
  ...params
1315
1432
  } = options;
1316
1433
  const {
@@ -1324,10 +1441,14 @@ class WidgetBaseSource {
1324
1441
  splitByCategoryLimit,
1325
1442
  splitByCategoryValues
1326
1443
  } = params;
1444
+ const source = _this8.getModelSource(filterOwner);
1445
+ const spatialFiltersResolution = _this8._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
1327
1446
  return Promise.resolve(executeModel({
1328
1447
  model: 'timeseries',
1329
1448
  source: {
1330
- ..._this8.getModelSource(filterOwner),
1449
+ ...source,
1450
+ spatialFiltersResolution,
1451
+ spatialFiltersMode,
1331
1452
  spatialFilter
1332
1453
  },
1333
1454
  params: {
@@ -1358,8 +1479,7 @@ WidgetBaseSource.defaultProps = {
1358
1479
  apiBaseUrl: DEFAULT_API_BASE_URL,
1359
1480
  clientId: getClient(),
1360
1481
  filters: {},
1361
- filtersLogicalOperator: 'and',
1362
- geoColumn: DEFAULT_GEO_COLUMN
1482
+ filtersLogicalOperator: 'and'
1363
1483
  };
1364
1484
 
1365
1485
  /**
@@ -1428,6 +1548,9 @@ class WidgetTableSource extends WidgetBaseSource {
1428
1548
  }
1429
1549
 
1430
1550
  // deck.gl
1551
+ // SPDX-License-Identifier: MIT
1552
+ // Copyright (c) vis.gl contributors
1553
+ /* eslint-disable camelcase */
1431
1554
  const h3QuerySource = function (options) {
1432
1555
  try {
1433
1556
  const {
@@ -1438,10 +1561,11 @@ const h3QuerySource = function (options) {
1438
1561
  queryParameters,
1439
1562
  filters
1440
1563
  } = options;
1564
+ const spatialDataType = 'h3';
1441
1565
  const urlParameters = {
1442
1566
  aggregationExp,
1443
1567
  spatialDataColumn,
1444
- spatialDataType: 'h3',
1568
+ spatialDataType,
1445
1569
  q: sqlQuery
1446
1570
  };
1447
1571
  if (aggregationResLevel) {
@@ -1455,7 +1579,12 @@ const h3QuerySource = function (options) {
1455
1579
  }
1456
1580
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1457
1581
  ...result,
1458
- widgetSource: new WidgetQuerySource(options)
1582
+ widgetSource: new WidgetQuerySource({
1583
+ ...options,
1584
+ // NOTE: Parameters with default values above must be explicitly passed here.
1585
+ spatialDataColumn,
1586
+ spatialDataType
1587
+ })
1459
1588
  })));
1460
1589
  } catch (e) {
1461
1590
  return Promise.reject(e);
@@ -1463,6 +1592,9 @@ const h3QuerySource = function (options) {
1463
1592
  };
1464
1593
 
1465
1594
  // deck.gl
1595
+ // SPDX-License-Identifier: MIT
1596
+ // Copyright (c) vis.gl contributors
1597
+ /* eslint-disable camelcase */
1466
1598
  const h3TableSource = function (options) {
1467
1599
  try {
1468
1600
  const {
@@ -1472,11 +1604,12 @@ const h3TableSource = function (options) {
1472
1604
  tableName,
1473
1605
  filters
1474
1606
  } = options;
1607
+ const spatialDataType = 'h3';
1475
1608
  const urlParameters = {
1476
1609
  aggregationExp,
1477
1610
  name: tableName,
1478
1611
  spatialDataColumn,
1479
- spatialDataType: 'h3'
1612
+ spatialDataType
1480
1613
  };
1481
1614
  if (aggregationResLevel) {
1482
1615
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1486,7 +1619,12 @@ const h3TableSource = function (options) {
1486
1619
  }
1487
1620
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1488
1621
  ...result,
1489
- widgetSource: new WidgetTableSource(options)
1622
+ widgetSource: new WidgetTableSource({
1623
+ ...options,
1624
+ // NOTE: Parameters with default values above must be explicitly passed here.
1625
+ spatialDataColumn,
1626
+ spatialDataType
1627
+ })
1490
1628
  })));
1491
1629
  } catch (e) {
1492
1630
  return Promise.reject(e);
@@ -1494,6 +1632,8 @@ const h3TableSource = function (options) {
1494
1632
  };
1495
1633
 
1496
1634
  // deck.gl
1635
+ // SPDX-License-Identifier: MIT
1636
+ // Copyright (c) vis.gl contributors
1497
1637
  const h3TilesetSource = function (options) {
1498
1638
  try {
1499
1639
  const {
@@ -1509,6 +1649,8 @@ const h3TilesetSource = function (options) {
1509
1649
  };
1510
1650
 
1511
1651
  // deck.gl
1652
+ // SPDX-License-Identifier: MIT
1653
+ // Copyright (c) vis.gl contributors
1512
1654
  const rasterSource = function (options) {
1513
1655
  try {
1514
1656
  const {
@@ -1528,6 +1670,9 @@ const rasterSource = function (options) {
1528
1670
  };
1529
1671
 
1530
1672
  // deck.gl
1673
+ // SPDX-License-Identifier: MIT
1674
+ // Copyright (c) vis.gl contributors
1675
+ /* eslint-disable camelcase */
1531
1676
  const quadbinQuerySource = function (options) {
1532
1677
  try {
1533
1678
  const {
@@ -1538,11 +1683,12 @@ const quadbinQuerySource = function (options) {
1538
1683
  queryParameters,
1539
1684
  filters
1540
1685
  } = options;
1686
+ const spatialDataType = 'quadbin';
1541
1687
  const urlParameters = {
1542
1688
  aggregationExp,
1543
1689
  q: sqlQuery,
1544
1690
  spatialDataColumn,
1545
- spatialDataType: 'quadbin'
1691
+ spatialDataType
1546
1692
  };
1547
1693
  if (aggregationResLevel) {
1548
1694
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1555,7 +1701,12 @@ const quadbinQuerySource = function (options) {
1555
1701
  }
1556
1702
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1557
1703
  ...result,
1558
- widgetSource: new WidgetQuerySource(options)
1704
+ widgetSource: new WidgetQuerySource({
1705
+ ...options,
1706
+ // NOTE: Parameters with default values above must be explicitly passed here.
1707
+ spatialDataColumn,
1708
+ spatialDataType
1709
+ })
1559
1710
  })));
1560
1711
  } catch (e) {
1561
1712
  return Promise.reject(e);
@@ -1563,6 +1714,9 @@ const quadbinQuerySource = function (options) {
1563
1714
  };
1564
1715
 
1565
1716
  // deck.gl
1717
+ // SPDX-License-Identifier: MIT
1718
+ // Copyright (c) vis.gl contributors
1719
+ /* eslint-disable camelcase */
1566
1720
  const quadbinTableSource = function (options) {
1567
1721
  try {
1568
1722
  const {
@@ -1572,11 +1726,12 @@ const quadbinTableSource = function (options) {
1572
1726
  tableName,
1573
1727
  filters
1574
1728
  } = options;
1729
+ const spatialDataType = 'quadbin';
1575
1730
  const urlParameters = {
1576
1731
  aggregationExp,
1577
1732
  name: tableName,
1578
1733
  spatialDataColumn,
1579
- spatialDataType: 'quadbin'
1734
+ spatialDataType
1580
1735
  };
1581
1736
  if (aggregationResLevel) {
1582
1737
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1586,7 +1741,12 @@ const quadbinTableSource = function (options) {
1586
1741
  }
1587
1742
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1588
1743
  ...result,
1589
- widgetSource: new WidgetTableSource(options)
1744
+ widgetSource: new WidgetTableSource({
1745
+ ...options,
1746
+ // NOTE: Parameters with default values above must be explicitly passed here.
1747
+ spatialDataColumn,
1748
+ spatialDataType
1749
+ })
1590
1750
  })));
1591
1751
  } catch (e) {
1592
1752
  return Promise.reject(e);
@@ -1594,6 +1754,8 @@ const quadbinTableSource = function (options) {
1594
1754
  };
1595
1755
 
1596
1756
  // deck.gl
1757
+ // SPDX-License-Identifier: MIT
1758
+ // Copyright (c) vis.gl contributors
1597
1759
  const quadbinTilesetSource = function (options) {
1598
1760
  try {
1599
1761
  const {
@@ -1609,6 +1771,9 @@ const quadbinTilesetSource = function (options) {
1609
1771
  };
1610
1772
 
1611
1773
  // deck.gl
1774
+ // SPDX-License-Identifier: MIT
1775
+ // Copyright (c) vis.gl contributors
1776
+ /* eslint-disable camelcase */
1612
1777
  const vectorQuerySource = function (options) {
1613
1778
  try {
1614
1779
  const {
@@ -1620,9 +1785,10 @@ const vectorQuerySource = function (options) {
1620
1785
  queryParameters,
1621
1786
  aggregationExp
1622
1787
  } = options;
1788
+ const spatialDataType = 'geo';
1623
1789
  const urlParameters = {
1624
1790
  spatialDataColumn,
1625
- spatialDataType: 'geo',
1791
+ spatialDataType,
1626
1792
  tileResolution: tileResolution.toString(),
1627
1793
  q: sqlQuery
1628
1794
  };
@@ -1640,7 +1806,13 @@ const vectorQuerySource = function (options) {
1640
1806
  }
1641
1807
  return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1642
1808
  ...result,
1643
- widgetSource: new WidgetQuerySource(options)
1809
+ widgetSource: new WidgetQuerySource({
1810
+ ...options,
1811
+ // NOTE: Parameters with default values above must be explicitly passed here.
1812
+ spatialDataColumn,
1813
+ spatialDataType,
1814
+ tileResolution
1815
+ })
1644
1816
  })));
1645
1817
  } catch (e) {
1646
1818
  return Promise.reject(e);
@@ -1648,6 +1820,9 @@ const vectorQuerySource = function (options) {
1648
1820
  };
1649
1821
 
1650
1822
  // deck.gl
1823
+ // SPDX-License-Identifier: MIT
1824
+ // Copyright (c) vis.gl contributors
1825
+ /* eslint-disable camelcase */
1651
1826
  const vectorTableSource = function (options) {
1652
1827
  try {
1653
1828
  const {
@@ -1658,10 +1833,11 @@ const vectorTableSource = function (options) {
1658
1833
  tileResolution = DEFAULT_TILE_RESOLUTION,
1659
1834
  aggregationExp
1660
1835
  } = options;
1836
+ const spatialDataType = 'geo';
1661
1837
  const urlParameters = {
1662
1838
  name: tableName,
1663
1839
  spatialDataColumn,
1664
- spatialDataType: 'geo',
1840
+ spatialDataType,
1665
1841
  tileResolution: tileResolution.toString()
1666
1842
  };
1667
1843
  if (columns) {
@@ -1675,7 +1851,13 @@ const vectorTableSource = function (options) {
1675
1851
  }
1676
1852
  return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1677
1853
  ...result,
1678
- widgetSource: new WidgetTableSource(options)
1854
+ widgetSource: new WidgetTableSource({
1855
+ ...options,
1856
+ // NOTE: Parameters with default values above must be explicitly passed here.
1857
+ spatialDataColumn,
1858
+ spatialDataType,
1859
+ tileResolution
1860
+ })
1679
1861
  })));
1680
1862
  } catch (e) {
1681
1863
  return Promise.reject(e);
@@ -1683,6 +1865,8 @@ const vectorTableSource = function (options) {
1683
1865
  };
1684
1866
 
1685
1867
  // deck.gl
1868
+ // SPDX-License-Identifier: MIT
1869
+ // Copyright (c) vis.gl contributors
1686
1870
  const vectorTilesetSource = function (options) {
1687
1871
  try {
1688
1872
  const {
@@ -1698,6 +1882,8 @@ const vectorTilesetSource = function (options) {
1698
1882
  };
1699
1883
 
1700
1884
  // deck.gl
1885
+ // SPDX-License-Identifier: MIT
1886
+ // Copyright (c) vis.gl contributors
1701
1887
  const query = function (options) {
1702
1888
  try {
1703
1889
  const {