@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.
- package/build/api-client.cjs +17 -24
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.js +18 -28
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +17 -61
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +18 -28
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/filters/tileFeaturesSpatialIndex.ts +15 -13
- package/src/filters/tileIntersection.ts +20 -23
package/build/api-client.js
CHANGED
|
@@ -4937,10 +4937,7 @@ import {
|
|
|
4937
4937
|
cellToBoundary as quadbinCellToBoundary,
|
|
4938
4938
|
geometryToCells as quadbinGeometryToCells
|
|
4939
4939
|
} from "quadbin";
|
|
4940
|
-
import {
|
|
4941
|
-
cellToBoundary as h3CellToBoundary,
|
|
4942
|
-
polygonToCells as h3PolygonToCells
|
|
4943
|
-
} from "h3-js";
|
|
4940
|
+
import { polygonToCells as h3PolygonToCells } from "h3-js";
|
|
4944
4941
|
|
|
4945
4942
|
// node_modules/@turf/bbox-clip/dist/esm/index.js
|
|
4946
4943
|
function lineclip(points, bbox2, result) {
|
|
@@ -5096,27 +5093,18 @@ function intersectTileQuadbin(parent, cellResolution, spatialFilter) {
|
|
|
5096
5093
|
}
|
|
5097
5094
|
var BBOX_WEST = [-180, -90, 0, 90];
|
|
5098
5095
|
var BBOX_EAST = [0, -90, 180, 90];
|
|
5099
|
-
function intersectTileH3(
|
|
5100
|
-
|
|
5101
|
-
type: "Polygon",
|
|
5102
|
-
coordinates: [h3CellToBoundary(parent, true)]
|
|
5103
|
-
};
|
|
5104
|
-
if (!spatialFilter || turf_boolean_within_default(tilePolygon, spatialFilter)) {
|
|
5096
|
+
function intersectTileH3(cellResolution, spatialFilter) {
|
|
5097
|
+
if (!spatialFilter) {
|
|
5105
5098
|
return true;
|
|
5106
5099
|
}
|
|
5107
|
-
const
|
|
5108
|
-
featureCollection([feature(tilePolygon), feature(spatialFilter)])
|
|
5109
|
-
);
|
|
5110
|
-
if (!clippedSpatialFilter) {
|
|
5111
|
-
return false;
|
|
5112
|
-
}
|
|
5100
|
+
const spatialFilterFeature = feature(spatialFilter);
|
|
5113
5101
|
const cellsWest = h3PolygonToCells(
|
|
5114
|
-
turf_bbox_clip_default(
|
|
5102
|
+
turf_bbox_clip_default(spatialFilterFeature, BBOX_WEST).geometry.coordinates,
|
|
5115
5103
|
cellResolution,
|
|
5116
5104
|
true
|
|
5117
5105
|
);
|
|
5118
5106
|
const cellsEast = h3PolygonToCells(
|
|
5119
|
-
turf_bbox_clip_default(
|
|
5107
|
+
turf_bbox_clip_default(spatialFilterFeature, BBOX_EAST).geometry.coordinates,
|
|
5120
5108
|
cellResolution,
|
|
5121
5109
|
true
|
|
5122
5110
|
);
|
|
@@ -5420,20 +5408,22 @@ function tileFeaturesSpatialIndex({
|
|
|
5420
5408
|
if (!cellResolution) {
|
|
5421
5409
|
return [];
|
|
5422
5410
|
}
|
|
5411
|
+
let intersection3;
|
|
5412
|
+
if (spatialIndex === "h3" /* H3 */) {
|
|
5413
|
+
intersection3 = intersectTileH3(cellResolution, spatialFilter);
|
|
5414
|
+
}
|
|
5423
5415
|
for (const tile of tiles) {
|
|
5424
5416
|
if (tile.isVisible === false || !tile.data) {
|
|
5425
5417
|
continue;
|
|
5426
5418
|
}
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
spatialFilter
|
|
5436
|
-
);
|
|
5419
|
+
if (spatialIndex === "quadbin" /* QUADBIN */) {
|
|
5420
|
+
const parent = getTileIndex(tile, spatialIndex);
|
|
5421
|
+
intersection3 = intersectTileQuadbin(
|
|
5422
|
+
parent,
|
|
5423
|
+
cellResolution,
|
|
5424
|
+
spatialFilter
|
|
5425
|
+
);
|
|
5426
|
+
}
|
|
5437
5427
|
if (!intersection3) continue;
|
|
5438
5428
|
tile.data.forEach((d) => {
|
|
5439
5429
|
if (intersection3 === true || intersection3.has(d.id)) {
|