@carto/api-client 0.5.0-alpha.13 → 0.5.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/worker.js CHANGED
@@ -26,324 +26,6 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
26
26
  ));
27
27
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
28
28
 
29
- // node_modules/tilebelt/index.js
30
- var require_tilebelt = __commonJS({
31
- "node_modules/tilebelt/index.js"(exports, module) {
32
- "use strict";
33
- var d2r = Math.PI / 180;
34
- var r2d = 180 / Math.PI;
35
- function tileToBBOX(tile) {
36
- var e = tile2lon(tile[0] + 1, tile[2]);
37
- var w = tile2lon(tile[0], tile[2]);
38
- var s = tile2lat(tile[1] + 1, tile[2]);
39
- var n = tile2lat(tile[1], tile[2]);
40
- return [w, s, e, n];
41
- }
42
- function tileToGeoJSON(tile) {
43
- var bbox = tileToBBOX(tile);
44
- var poly = {
45
- type: "Polygon",
46
- coordinates: [
47
- [
48
- [bbox[0], bbox[1]],
49
- [bbox[0], bbox[3]],
50
- [bbox[2], bbox[3]],
51
- [bbox[2], bbox[1]],
52
- [bbox[0], bbox[1]]
53
- ]
54
- ]
55
- };
56
- return poly;
57
- }
58
- function tile2lon(x, z) {
59
- return x / Math.pow(2, z) * 360 - 180;
60
- }
61
- function tile2lat(y, z) {
62
- var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);
63
- return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
64
- }
65
- function pointToTile(lon, lat, z) {
66
- var tile = pointToTileFraction(lon, lat, z);
67
- tile[0] = Math.floor(tile[0]);
68
- tile[1] = Math.floor(tile[1]);
69
- return tile;
70
- }
71
- function getChildren(tile) {
72
- return [
73
- [tile[0] * 2, tile[1] * 2, tile[2] + 1],
74
- [tile[0] * 2 + 1, tile[1] * 2, tile[2] + 1],
75
- [tile[0] * 2 + 1, tile[1] * 2 + 1, tile[2] + 1],
76
- [tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1]
77
- ];
78
- }
79
- function getParent(tile) {
80
- if (tile[0] % 2 === 0 && tile[1] % 2 === 0) {
81
- return [tile[0] / 2, tile[1] / 2, tile[2] - 1];
82
- } else if (tile[0] % 2 === 0 && !tile[1] % 2 === 0) {
83
- return [tile[0] / 2, (tile[1] - 1) / 2, tile[2] - 1];
84
- } else if (!tile[0] % 2 === 0 && tile[1] % 2 === 0) {
85
- return [(tile[0] - 1) / 2, tile[1] / 2, tile[2] - 1];
86
- } else {
87
- return [(tile[0] - 1) / 2, (tile[1] - 1) / 2, tile[2] - 1];
88
- }
89
- }
90
- function getSiblings(tile) {
91
- return getChildren(getParent(tile));
92
- }
93
- function hasSiblings(tile, tiles2) {
94
- var siblings = getSiblings(tile);
95
- for (var i = 0; i < siblings.length; i++) {
96
- if (!hasTile(tiles2, siblings[i])) return false;
97
- }
98
- return true;
99
- }
100
- function hasTile(tiles2, tile) {
101
- for (var i = 0; i < tiles2.length; i++) {
102
- if (tilesEqual(tiles2[i], tile)) return true;
103
- }
104
- return false;
105
- }
106
- function tilesEqual(tile1, tile2) {
107
- return tile1[0] === tile2[0] && tile1[1] === tile2[1] && tile1[2] === tile2[2];
108
- }
109
- function tileToQuadkey(tile) {
110
- var index = "";
111
- for (var z = tile[2]; z > 0; z--) {
112
- var b = 0;
113
- var mask = 1 << z - 1;
114
- if ((tile[0] & mask) !== 0) b++;
115
- if ((tile[1] & mask) !== 0) b += 2;
116
- index += b.toString();
117
- }
118
- return index;
119
- }
120
- function quadkeyToTile(quadkey) {
121
- var x = 0;
122
- var y = 0;
123
- var z = quadkey.length;
124
- for (var i = z; i > 0; i--) {
125
- var mask = 1 << i - 1;
126
- switch (quadkey[z - i]) {
127
- case "0":
128
- break;
129
- case "1":
130
- x |= mask;
131
- break;
132
- case "2":
133
- y |= mask;
134
- break;
135
- case "3":
136
- x |= mask;
137
- y |= mask;
138
- break;
139
- }
140
- }
141
- return [x, y, z];
142
- }
143
- function bboxToTile(bboxCoords) {
144
- var min2 = pointToTile(bboxCoords[0], bboxCoords[1], 32);
145
- var max2 = pointToTile(bboxCoords[2], bboxCoords[3], 32);
146
- var bbox = [min2[0], min2[1], max2[0], max2[1]];
147
- var z = getBboxZoom(bbox);
148
- if (z === 0) return [0, 0, 0];
149
- var x = bbox[0] >>> 32 - z;
150
- var y = bbox[1] >>> 32 - z;
151
- return [x, y, z];
152
- }
153
- function getBboxZoom(bbox) {
154
- var MAX_ZOOM = 28;
155
- for (var z = 0; z < MAX_ZOOM; z++) {
156
- var mask = 1 << 32 - (z + 1);
157
- if ((bbox[0] & mask) != (bbox[2] & mask) || (bbox[1] & mask) != (bbox[3] & mask)) {
158
- return z;
159
- }
160
- }
161
- return MAX_ZOOM;
162
- }
163
- function pointToTileFraction(lon, lat, z) {
164
- var sin2 = Math.sin(lat * d2r), z2 = Math.pow(2, z), x = z2 * (lon / 360 + 0.5), y = z2 * (0.5 - 0.25 * Math.log((1 + sin2) / (1 - sin2)) / Math.PI);
165
- return [x, y, z];
166
- }
167
- module.exports = {
168
- tileToGeoJSON,
169
- tileToBBOX,
170
- getChildren,
171
- getParent,
172
- getSiblings,
173
- hasTile,
174
- hasSiblings,
175
- tilesEqual,
176
- tileToQuadkey,
177
- quadkeyToTile,
178
- pointToTile,
179
- bboxToTile,
180
- pointToTileFraction
181
- };
182
- }
183
- });
184
-
185
- // node_modules/@mapbox/tile-cover/index.js
186
- var require_tile_cover = __commonJS({
187
- "node_modules/@mapbox/tile-cover/index.js"(exports) {
188
- "use strict";
189
- var tilebelt = require_tilebelt();
190
- exports.geojson = function(geom, limits) {
191
- return {
192
- type: "FeatureCollection",
193
- features: getTiles(geom, limits).map(tileToFeature)
194
- };
195
- };
196
- function tileToFeature(t) {
197
- return {
198
- type: "Feature",
199
- geometry: tilebelt.tileToGeoJSON(t),
200
- properties: {}
201
- };
202
- }
203
- exports.tiles = getTiles;
204
- exports.indexes = function(geom, limits) {
205
- return getTiles(geom, limits).map(tilebelt.tileToQuadkey);
206
- };
207
- function getTiles(geom, limits) {
208
- var i, tile, coords = geom.coordinates, maxZoom = limits.max_zoom, tileHash = {}, tiles2 = [];
209
- if (geom.type === "Point") {
210
- return [tilebelt.pointToTile(coords[0], coords[1], maxZoom)];
211
- } else if (geom.type === "MultiPoint") {
212
- for (i = 0; i < coords.length; i++) {
213
- tile = tilebelt.pointToTile(coords[i][0], coords[i][1], maxZoom);
214
- tileHash[toID(tile[0], tile[1], tile[2])] = true;
215
- }
216
- } else if (geom.type === "LineString") {
217
- lineCover(tileHash, coords, maxZoom);
218
- } else if (geom.type === "MultiLineString") {
219
- for (i = 0; i < coords.length; i++) {
220
- lineCover(tileHash, coords[i], maxZoom);
221
- }
222
- } else if (geom.type === "Polygon") {
223
- polygonCover(tileHash, tiles2, coords, maxZoom);
224
- } else if (geom.type === "MultiPolygon") {
225
- for (i = 0; i < coords.length; i++) {
226
- polygonCover(tileHash, tiles2, coords[i], maxZoom);
227
- }
228
- } else {
229
- throw new Error("Geometry type not implemented");
230
- }
231
- if (limits.min_zoom !== maxZoom) {
232
- var len = tiles2.length;
233
- appendHashTiles(tileHash, tiles2);
234
- for (i = 0; i < len; i++) {
235
- var t = tiles2[i];
236
- tileHash[toID(t[0], t[1], t[2])] = true;
237
- }
238
- return mergeTiles(tileHash, tiles2, limits);
239
- }
240
- appendHashTiles(tileHash, tiles2);
241
- return tiles2;
242
- }
243
- function mergeTiles(tileHash, tiles2, limits) {
244
- var mergedTiles = [];
245
- for (var z = limits.max_zoom; z > limits.min_zoom; z--) {
246
- var parentTileHash = {};
247
- var parentTiles = [];
248
- for (var i = 0; i < tiles2.length; i++) {
249
- var t = tiles2[i];
250
- if (t[0] % 2 === 0 && t[1] % 2 === 0) {
251
- var id2 = toID(t[0] + 1, t[1], z), id3 = toID(t[0], t[1] + 1, z), id4 = toID(t[0] + 1, t[1] + 1, z);
252
- if (tileHash[id2] && tileHash[id3] && tileHash[id4]) {
253
- tileHash[toID(t[0], t[1], t[2])] = false;
254
- tileHash[id2] = false;
255
- tileHash[id3] = false;
256
- tileHash[id4] = false;
257
- var parentTile = [t[0] / 2, t[1] / 2, z - 1];
258
- if (z - 1 === limits.min_zoom) mergedTiles.push(parentTile);
259
- else {
260
- parentTileHash[toID(t[0] / 2, t[1] / 2, z - 1)] = true;
261
- parentTiles.push(parentTile);
262
- }
263
- }
264
- }
265
- }
266
- for (i = 0; i < tiles2.length; i++) {
267
- t = tiles2[i];
268
- if (tileHash[toID(t[0], t[1], t[2])]) mergedTiles.push(t);
269
- }
270
- tileHash = parentTileHash;
271
- tiles2 = parentTiles;
272
- }
273
- return mergedTiles;
274
- }
275
- function polygonCover(tileHash, tileArray, geom, zoom) {
276
- var intersections = [];
277
- for (var i = 0; i < geom.length; i++) {
278
- var ring = [];
279
- lineCover(tileHash, geom[i], zoom, ring);
280
- for (var j = 0, len = ring.length, k = len - 1; j < len; k = j++) {
281
- var m = (j + 1) % len;
282
- var y = ring[j][1];
283
- if ((y > ring[k][1] || y > ring[m][1]) && // not local minimum
284
- (y < ring[k][1] || y < ring[m][1]) && // not local maximum
285
- y !== ring[m][1]) intersections.push(ring[j]);
286
- }
287
- }
288
- intersections.sort(compareTiles);
289
- for (i = 0; i < intersections.length; i += 2) {
290
- y = intersections[i][1];
291
- for (var x = intersections[i][0] + 1; x < intersections[i + 1][0]; x++) {
292
- var id = toID(x, y, zoom);
293
- if (!tileHash[id]) {
294
- tileArray.push([x, y, zoom]);
295
- }
296
- }
297
- }
298
- }
299
- function compareTiles(a, b) {
300
- return a[1] - b[1] || a[0] - b[0];
301
- }
302
- function lineCover(tileHash, coords, maxZoom, ring) {
303
- var prevX, prevY;
304
- for (var i = 0; i < coords.length - 1; i++) {
305
- var start = tilebelt.pointToTileFraction(coords[i][0], coords[i][1], maxZoom), stop = tilebelt.pointToTileFraction(coords[i + 1][0], coords[i + 1][1], maxZoom), x0 = start[0], y0 = start[1], x1 = stop[0], y1 = stop[1], dx = x1 - x0, dy = y1 - y0;
306
- if (dy === 0 && dx === 0) continue;
307
- var sx = dx > 0 ? 1 : -1, sy = dy > 0 ? 1 : -1, x = Math.floor(x0), y = Math.floor(y0), tMaxX = dx === 0 ? Infinity : Math.abs(((dx > 0 ? 1 : 0) + x - x0) / dx), tMaxY = dy === 0 ? Infinity : Math.abs(((dy > 0 ? 1 : 0) + y - y0) / dy), tdx = Math.abs(sx / dx), tdy = Math.abs(sy / dy);
308
- if (x !== prevX || y !== prevY) {
309
- tileHash[toID(x, y, maxZoom)] = true;
310
- if (ring && y !== prevY) ring.push([x, y]);
311
- prevX = x;
312
- prevY = y;
313
- }
314
- while (tMaxX < 1 || tMaxY < 1) {
315
- if (tMaxX < tMaxY) {
316
- tMaxX += tdx;
317
- x += sx;
318
- } else {
319
- tMaxY += tdy;
320
- y += sy;
321
- }
322
- tileHash[toID(x, y, maxZoom)] = true;
323
- if (ring && y !== prevY) ring.push([x, y]);
324
- prevX = x;
325
- prevY = y;
326
- }
327
- }
328
- if (ring && y === ring[0][1]) ring.pop();
329
- }
330
- function appendHashTiles(hash, tiles2) {
331
- var keys = Object.keys(hash);
332
- for (var i = 0; i < keys.length; i++) {
333
- tiles2.push(fromID(+keys[i]));
334
- }
335
- }
336
- function toID(x, y, z) {
337
- var dim = 2 * (1 << z);
338
- return (dim * y + x) * 32 + z;
339
- }
340
- function fromID(id) {
341
- var z = id % 32, dim = 2 * (1 << z), xy = (id - z) / 32, x = xy % dim, y = (xy - x) / dim % dim;
342
- return [x, y, z];
343
- }
344
- }
345
- });
346
-
347
29
  // node_modules/thenby/thenBy.module.js
348
30
  var require_thenBy_module = __commonJS({
349
31
  "node_modules/thenby/thenBy.module.js"(exports, module) {
@@ -755,14 +437,14 @@ function transformMultiPolygon2(multiPolygon, bbox) {
755
437
  import { featureCollection } from "@turf/helpers";
756
438
  var FEATURE_GEOM_PROPERTY = "__geomValue";
757
439
  function tileFeaturesGeometries({
758
- tiles: tiles2,
440
+ tiles,
759
441
  tileFormat,
760
442
  spatialFilter,
761
443
  uniqueIdProperty,
762
444
  options
763
445
  }) {
764
446
  const map = /* @__PURE__ */ new Map();
765
- for (const tile of tiles2) {
447
+ for (const tile of tiles) {
766
448
  if (tile.isVisible === false || !tile.data) {
767
449
  continue;
768
450
  }
@@ -1043,57 +725,19 @@ function createIndicesForPoints(data) {
1043
725
  data.pointIndices = pointIndices;
1044
726
  }
1045
727
 
1046
- // node_modules/quadbin/dist/esm/index.js
1047
- var import_tile_cover = __toESM(require_tile_cover(), 1);
1048
- var B = [
1049
- 0x5555555555555555n,
1050
- 0x3333333333333333n,
1051
- 0x0f0f0f0f0f0f0f0fn,
1052
- 0x00ff00ff00ff00ffn,
1053
- 0x0000ffff0000ffffn,
1054
- 0x00000000ffffffffn
1055
- ];
1056
- var S = [0n, 1n, 2n, 4n, 8n, 16n];
1057
- function tileToCell(tile) {
1058
- if (tile.z < 0 || tile.z > 26) {
1059
- throw new Error("Wrong zoom");
1060
- }
1061
- const z = BigInt(tile.z);
1062
- let x = BigInt(tile.x) << 32n - z;
1063
- let y = BigInt(tile.y) << 32n - z;
1064
- for (let i = 0; i < 5; i++) {
1065
- const s = S[5 - i];
1066
- const b = B[4 - i];
1067
- x = (x | x << s) & b;
1068
- y = (y | y << s) & b;
1069
- }
1070
- const quadbin = 0x4000000000000000n | 1n << 59n | // | (mode << 59) | (mode_dep << 57)
1071
- z << 52n | (x | y << 1n) >> 12n | 0xfffffffffffffn >> z * 2n;
1072
- return quadbin;
1073
- }
1074
- function getResolution(quadbin) {
1075
- return quadbin >> 52n & 0x1fn;
1076
- }
1077
- function geometryToCells(geometry, resolution) {
1078
- const zoom = Number(resolution);
1079
- return (0, import_tile_cover.tiles)(geometry, {
1080
- min_zoom: zoom,
1081
- max_zoom: zoom
1082
- }).map(([x, y, z]) => tileToCell({ x, y, z }));
1083
- }
1084
-
1085
728
  // src/filters/tileFeaturesSpatialIndex.ts
729
+ import { getResolution as quadbinGetResolution, geometryToCells } from "quadbin";
1086
730
  import bboxClip from "@turf/bbox-clip";
1087
731
  import { getResolution as h3GetResolution, polygonToCells } from "h3-js";
1088
732
  function tileFeaturesSpatialIndex({
1089
- tiles: tiles2,
733
+ tiles,
1090
734
  spatialFilter,
1091
735
  spatialDataColumn,
1092
736
  spatialDataType
1093
737
  }) {
1094
738
  const map = /* @__PURE__ */ new Map();
1095
739
  const spatialIndex = getSpatialIndex(spatialDataType);
1096
- const resolution = getResolution2(tiles2, spatialIndex);
740
+ const resolution = getResolution(tiles, spatialIndex);
1097
741
  const spatialIndexIDName = spatialDataColumn ? spatialDataColumn : spatialIndex;
1098
742
  if (!resolution) {
1099
743
  return [];
@@ -1103,7 +747,7 @@ function tileFeaturesSpatialIndex({
1103
747
  return [];
1104
748
  }
1105
749
  const cellsSet = new Set(cells);
1106
- for (const tile of tiles2) {
750
+ for (const tile of tiles) {
1107
751
  if (tile.isVisible === false || !tile.data) {
1108
752
  continue;
1109
753
  }
@@ -1115,13 +759,13 @@ function tileFeaturesSpatialIndex({
1115
759
  }
1116
760
  return Array.from(map.values());
1117
761
  }
1118
- function getResolution2(tiles2, spatialIndex) {
1119
- const data = tiles2.find((tile) => tile.data?.length)?.data;
762
+ function getResolution(tiles, spatialIndex) {
763
+ const data = tiles.find((tile) => tile.data?.length)?.data;
1120
764
  if (!data) {
1121
765
  return;
1122
766
  }
1123
767
  if (spatialIndex === "quadbin" /* QUADBIN */) {
1124
- return Number(getResolution(data[0].id));
768
+ return Number(quadbinGetResolution(data[0].id));
1125
769
  }
1126
770
  if (spatialIndex === "h3" /* H3 */) {
1127
771
  return h3GetResolution(data[0].id);
@@ -1163,30 +807,109 @@ var DEFAULT_GEO_COLUMN = "geom";
1163
807
  var DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
1164
808
  var DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
1165
809
 
810
+ // src/filters/tileFeaturesRaster.ts
811
+ import {
812
+ cellToChildren as _cellToChildren,
813
+ cellToTile,
814
+ geometryToCells as geometryToCells2,
815
+ getResolution as getResolution2
816
+ } from "quadbin";
817
+ function tileFeaturesRaster({
818
+ tiles,
819
+ ...options
820
+ }) {
821
+ const metadataByBand = {};
822
+ for (const band of options.rasterMetadata.bands) {
823
+ metadataByBand[band.name] = { ...band, nodata: Number(band.nodata) };
824
+ }
825
+ tiles = tiles.filter(isRasterTileVisible);
826
+ if (tiles.length === 0) return [];
827
+ const tileResolution = getResolution2(tiles[0].index.q);
828
+ const tileBlockSize = tiles[0].data.blockSize;
829
+ const cellResolution = tileResolution + BigInt(Math.log2(tileBlockSize));
830
+ const spatialFilterCells = new Set(
831
+ geometryToCells2(options.spatialFilter, cellResolution)
832
+ );
833
+ const data = /* @__PURE__ */ new Map();
834
+ for (const tile of tiles) {
835
+ const parent = tile.index.q;
836
+ const children = cellToChildrenSorted(parent, cellResolution);
837
+ for (let i = 0; i < children.length; i++) {
838
+ if (!spatialFilterCells.has(children[i])) continue;
839
+ const cellData = {};
840
+ let cellDataExists = false;
841
+ for (const band in tile.data.cells.numericProps) {
842
+ const value = tile.data.cells.numericProps[band].value[i];
843
+ const bandMetadata = metadataByBand[band];
844
+ if (isValidBandValue(value, bandMetadata.nodata)) {
845
+ cellData[band] = tile.data.cells.numericProps[band].value[i];
846
+ cellDataExists = true;
847
+ }
848
+ }
849
+ if (cellDataExists) {
850
+ data.set(children[i], cellData);
851
+ }
852
+ }
853
+ }
854
+ return Array.from(data.values());
855
+ }
856
+ function isRasterTile(tile) {
857
+ return !!tile.data?.cells;
858
+ }
859
+ function isRasterTileVisible(tile) {
860
+ return !!(tile.isVisible && tile.data?.cells?.numericProps);
861
+ }
862
+ function cellToChildrenSorted(parent, resolution) {
863
+ return _cellToChildren(parent, resolution).sort(
864
+ (cellA, cellB) => {
865
+ const tileA = cellToTile(cellA);
866
+ const tileB = cellToTile(cellB);
867
+ if (tileA.y !== tileB.y) {
868
+ return tileA.y > tileB.y ? 1 : -1;
869
+ }
870
+ return tileA.x > tileB.x ? 1 : -1;
871
+ }
872
+ );
873
+ }
874
+ function isValidBandValue(value, nodata) {
875
+ return Number.isNaN(value) ? false : nodata !== value;
876
+ }
877
+
1166
878
  // src/filters/tileFeatures.ts
1167
879
  function tileFeatures({
1168
- tiles: tiles2,
880
+ tiles,
1169
881
  spatialFilter,
1170
882
  uniqueIdProperty,
1171
883
  tileFormat,
1172
884
  spatialDataColumn = DEFAULT_GEO_COLUMN,
1173
885
  spatialDataType,
886
+ rasterMetadata,
1174
887
  options = {}
1175
888
  }) {
1176
- if (spatialDataType !== "geo") {
1177
- return tileFeaturesSpatialIndex({
1178
- tiles: tiles2,
889
+ if (spatialDataType === "geo") {
890
+ return tileFeaturesGeometries({
891
+ tiles,
892
+ tileFormat,
893
+ spatialFilter,
894
+ uniqueIdProperty,
895
+ options
896
+ });
897
+ }
898
+ if (tiles.some(isRasterTile)) {
899
+ assert(rasterMetadata, "Missing raster metadata");
900
+ return tileFeaturesRaster({
901
+ tiles,
1179
902
  spatialFilter,
1180
903
  spatialDataColumn,
1181
- spatialDataType
904
+ spatialDataType,
905
+ rasterMetadata
1182
906
  });
1183
907
  }
1184
- return tileFeaturesGeometries({
1185
- tiles: tiles2,
1186
- tileFormat,
908
+ return tileFeaturesSpatialIndex({
909
+ tiles,
1187
910
  spatialFilter,
1188
- uniqueIdProperty,
1189
- options
911
+ spatialDataColumn,
912
+ spatialDataType
1190
913
  });
1191
914
  }
1192
915
 
@@ -1652,8 +1375,8 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1652
1375
  * After tiles are loaded, {@link extractTileFeatures} must be called
1653
1376
  * before computing statistics on the tiles.
1654
1377
  */
1655
- loadTiles(tiles2) {
1656
- this._tiles = tiles2;
1378
+ loadTiles(tiles) {
1379
+ this._tiles = tiles;
1657
1380
  this._features.length = 0;
1658
1381
  }
1659
1382
  /** Configures options used to extract features from tiles. */
@@ -1667,12 +1390,10 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1667
1390
  return;
1668
1391
  }
1669
1392
  this._features = tileFeatures({
1670
- tiles: this._tiles,
1671
- tileFormat: this.props.tileFormat,
1393
+ ...this.props,
1672
1394
  ...this._tileFeatureExtractOptions,
1673
- spatialFilter,
1674
- spatialDataColumn: this.props.spatialDataColumn,
1675
- spatialDataType: this.props.spatialDataType
1395
+ tiles: this._tiles,
1396
+ spatialFilter
1676
1397
  });
1677
1398
  prevInputs.spatialFilter = spatialFilter;
1678
1399
  }
@@ -1703,12 +1424,6 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1703
1424
  filterOwner,
1704
1425
  spatialFilter
1705
1426
  }) {
1706
- if (operation === "custom") {
1707
- throw new Error("Custom aggregation not supported for tilesets");
1708
- }
1709
- if (column && column !== "*" || operation !== "count") {
1710
- assertColumn(this._features, column);
1711
- }
1712
1427
  const filteredFeatures = this._getFilteredFeatures(
1713
1428
  spatialFilter,
1714
1429
  filters,
@@ -1717,6 +1432,12 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1717
1432
  if (filteredFeatures.length === 0 && operation !== "count") {
1718
1433
  return { value: null };
1719
1434
  }
1435
+ if (operation === "custom") {
1436
+ throw new Error("Custom aggregation not supported for tilesets");
1437
+ }
1438
+ if (column && column !== "*" || operation !== "count") {
1439
+ assertColumn(this._features, column);
1440
+ }
1720
1441
  const targetOperation = aggregationFunctions[operation];
1721
1442
  return {
1722
1443
  value: targetOperation(filteredFeatures, column, joinOperation)
@@ -1881,7 +1602,6 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1881
1602
  filterOwner,
1882
1603
  spatialFilter
1883
1604
  }) {
1884
- assertColumn(this._features, column);
1885
1605
  const filteredFeatures = this._getFilteredFeatures(
1886
1606
  spatialFilter,
1887
1607
  filters,
@@ -1890,6 +1610,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
1890
1610
  if (!this._features.length) {
1891
1611
  return null;
1892
1612
  }
1613
+ assertColumn(this._features, column);
1893
1614
  return {
1894
1615
  min: aggregationFunctions.min(filteredFeatures, column),
1895
1616
  max: aggregationFunctions.max(filteredFeatures, column)