@carto/api-client 0.5.7-alpha-optional-spatial-filter.0 → 0.5.7-alpha-optional-spatial-filter.1

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.
@@ -19254,28 +19254,6 @@
19254
19254
  }
19255
19255
  return out;
19256
19256
  }
19257
- function readSingleCoord(cAddress) {
19258
- return radsToDegs(libh3.getValue(cAddress, "double"));
19259
- }
19260
- function readLatLng(cAddress) {
19261
- return [readSingleCoord(cAddress), readSingleCoord(cAddress + SZ_DBL)];
19262
- }
19263
- function readLatLngGeoJson(cAddress) {
19264
- return [readSingleCoord(cAddress + SZ_DBL), readSingleCoord(cAddress)];
19265
- }
19266
- function readCellBoundary(cellBoundary, geoJsonCoords, closedLoop) {
19267
- var numVerts = libh3.getValue(cellBoundary, "i32");
19268
- var vertsPos = cellBoundary + SZ_DBL;
19269
- var out = [];
19270
- var readCoord = geoJsonCoords ? readLatLngGeoJson : readLatLng;
19271
- for (var i = 0; i < numVerts * 2; i += 2) {
19272
- out.push(readCoord(vertsPos + SZ_DBL * i));
19273
- }
19274
- if (closedLoop) {
19275
- out.push(out[0]);
19276
- }
19277
- return out;
19278
- }
19279
19257
  function getResolution2(h3Index) {
19280
19258
  var ref = h3IndexToSplitLong(h3Index);
19281
19259
  var lower = ref[0];
@@ -19285,18 +19263,6 @@
19285
19263
  }
19286
19264
  return H3.getResolution(lower, upper);
19287
19265
  }
19288
- function cellToBoundary2(h3Index, formatAsGeoJson) {
19289
- var cellBoundary = libh3._malloc(SZ_CELLBOUNDARY);
19290
- var ref = h3IndexToSplitLong(h3Index);
19291
- var lower = ref[0];
19292
- var upper = ref[1];
19293
- try {
19294
- throwIfError(H3.cellToBoundary(lower, upper, cellBoundary));
19295
- return readCellBoundary(cellBoundary, formatAsGeoJson, formatAsGeoJson);
19296
- } finally {
19297
- libh3._free(cellBoundary);
19298
- }
19299
- }
19300
19266
  function polygonToCells(coordinates, res, isGeoJson) {
19301
19267
  validateRes(res);
19302
19268
  isGeoJson = Boolean(isGeoJson);
@@ -19328,9 +19294,6 @@
19328
19294
  function degsToRads(deg) {
19329
19295
  return deg * Math.PI / 180;
19330
19296
  }
19331
- function radsToDegs(rad) {
19332
- return rad * 180 / Math.PI;
19333
- }
19334
19297
 
19335
19298
  // node_modules/@turf/bbox-clip/dist/esm/index.js
19336
19299
  function lineclip(points, bbox2, result) {
@@ -19486,27 +19449,18 @@
19486
19449
  }
19487
19450
  var BBOX_WEST = [-180, -90, 0, 90];
19488
19451
  var BBOX_EAST = [0, -90, 180, 90];
19489
- function intersectTileH3(parent, cellResolution, spatialFilter) {
19490
- const tilePolygon = {
19491
- type: "Polygon",
19492
- coordinates: [cellToBoundary2(parent, true)]
19493
- };
19494
- if (!spatialFilter || turf_boolean_within_default(tilePolygon, spatialFilter)) {
19452
+ function intersectTileH3(cellResolution, spatialFilter) {
19453
+ if (!spatialFilter) {
19495
19454
  return true;
19496
19455
  }
19497
- const clippedSpatialFilter = turf_intersect_default(
19498
- featureCollection([feature(tilePolygon), feature(spatialFilter)])
19499
- );
19500
- if (!clippedSpatialFilter) {
19501
- return false;
19502
- }
19456
+ const spatialFilterFeature = feature(spatialFilter);
19503
19457
  const cellsWest = polygonToCells(
19504
- turf_bbox_clip_default(clippedSpatialFilter, BBOX_WEST).geometry.coordinates,
19458
+ turf_bbox_clip_default(spatialFilterFeature, BBOX_WEST).geometry.coordinates,
19505
19459
  cellResolution,
19506
19460
  true
19507
19461
  );
19508
19462
  const cellsEast = polygonToCells(
19509
- turf_bbox_clip_default(clippedSpatialFilter, BBOX_EAST).geometry.coordinates,
19463
+ turf_bbox_clip_default(spatialFilterFeature, BBOX_EAST).geometry.coordinates,
19510
19464
  cellResolution,
19511
19465
  true
19512
19466
  );
@@ -19808,20 +19762,22 @@
19808
19762
  if (!cellResolution) {
19809
19763
  return [];
19810
19764
  }
19765
+ let intersection3;
19766
+ if (spatialIndex === "h3" /* H3 */) {
19767
+ intersection3 = intersectTileH3(cellResolution, spatialFilter);
19768
+ }
19811
19769
  for (const tile of tiles2) {
19812
19770
  if (tile.isVisible === false || !tile.data) {
19813
19771
  continue;
19814
19772
  }
19815
- const parent = getTileIndex(tile, spatialIndex);
19816
- const intersection3 = spatialIndex === "quadbin" /* QUADBIN */ ? intersectTileQuadbin(
19817
- parent,
19818
- cellResolution,
19819
- spatialFilter
19820
- ) : intersectTileH3(
19821
- parent,
19822
- cellResolution,
19823
- spatialFilter
19824
- );
19773
+ if (spatialIndex === "quadbin" /* QUADBIN */) {
19774
+ const parent = getTileIndex(tile, spatialIndex);
19775
+ intersection3 = intersectTileQuadbin(
19776
+ parent,
19777
+ cellResolution,
19778
+ spatialFilter
19779
+ );
19780
+ }
19825
19781
  if (!intersection3) continue;
19826
19782
  tile.data.forEach((d) => {
19827
19783
  if (intersection3 === true || intersection3.has(d.id)) {