@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/worker.js
CHANGED
|
@@ -4883,10 +4883,7 @@ import {
|
|
|
4883
4883
|
cellToBoundary as quadbinCellToBoundary,
|
|
4884
4884
|
geometryToCells as quadbinGeometryToCells
|
|
4885
4885
|
} from "quadbin";
|
|
4886
|
-
import {
|
|
4887
|
-
cellToBoundary as h3CellToBoundary,
|
|
4888
|
-
polygonToCells as h3PolygonToCells
|
|
4889
|
-
} from "h3-js";
|
|
4886
|
+
import { polygonToCells as h3PolygonToCells } from "h3-js";
|
|
4890
4887
|
|
|
4891
4888
|
// node_modules/@turf/bbox-clip/dist/esm/index.js
|
|
4892
4889
|
function lineclip(points, bbox2, result) {
|
|
@@ -5042,27 +5039,18 @@ function intersectTileQuadbin(parent, cellResolution, spatialFilter) {
|
|
|
5042
5039
|
}
|
|
5043
5040
|
var BBOX_WEST = [-180, -90, 0, 90];
|
|
5044
5041
|
var BBOX_EAST = [0, -90, 180, 90];
|
|
5045
|
-
function intersectTileH3(
|
|
5046
|
-
|
|
5047
|
-
type: "Polygon",
|
|
5048
|
-
coordinates: [h3CellToBoundary(parent, true)]
|
|
5049
|
-
};
|
|
5050
|
-
if (!spatialFilter || turf_boolean_within_default(tilePolygon, spatialFilter)) {
|
|
5042
|
+
function intersectTileH3(cellResolution, spatialFilter) {
|
|
5043
|
+
if (!spatialFilter) {
|
|
5051
5044
|
return true;
|
|
5052
5045
|
}
|
|
5053
|
-
const
|
|
5054
|
-
featureCollection([feature(tilePolygon), feature(spatialFilter)])
|
|
5055
|
-
);
|
|
5056
|
-
if (!clippedSpatialFilter) {
|
|
5057
|
-
return false;
|
|
5058
|
-
}
|
|
5046
|
+
const spatialFilterFeature = feature(spatialFilter);
|
|
5059
5047
|
const cellsWest = h3PolygonToCells(
|
|
5060
|
-
turf_bbox_clip_default(
|
|
5048
|
+
turf_bbox_clip_default(spatialFilterFeature, BBOX_WEST).geometry.coordinates,
|
|
5061
5049
|
cellResolution,
|
|
5062
5050
|
true
|
|
5063
5051
|
);
|
|
5064
5052
|
const cellsEast = h3PolygonToCells(
|
|
5065
|
-
turf_bbox_clip_default(
|
|
5053
|
+
turf_bbox_clip_default(spatialFilterFeature, BBOX_EAST).geometry.coordinates,
|
|
5066
5054
|
cellResolution,
|
|
5067
5055
|
true
|
|
5068
5056
|
);
|
|
@@ -5366,20 +5354,22 @@ function tileFeaturesSpatialIndex({
|
|
|
5366
5354
|
if (!cellResolution) {
|
|
5367
5355
|
return [];
|
|
5368
5356
|
}
|
|
5357
|
+
let intersection3;
|
|
5358
|
+
if (spatialIndex === "h3" /* H3 */) {
|
|
5359
|
+
intersection3 = intersectTileH3(cellResolution, spatialFilter);
|
|
5360
|
+
}
|
|
5369
5361
|
for (const tile of tiles) {
|
|
5370
5362
|
if (tile.isVisible === false || !tile.data) {
|
|
5371
5363
|
continue;
|
|
5372
5364
|
}
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
spatialFilter
|
|
5382
|
-
);
|
|
5365
|
+
if (spatialIndex === "quadbin" /* QUADBIN */) {
|
|
5366
|
+
const parent = getTileIndex(tile, spatialIndex);
|
|
5367
|
+
intersection3 = intersectTileQuadbin(
|
|
5368
|
+
parent,
|
|
5369
|
+
cellResolution,
|
|
5370
|
+
spatialFilter
|
|
5371
|
+
);
|
|
5372
|
+
}
|
|
5383
5373
|
if (!intersection3) continue;
|
|
5384
5374
|
tile.data.forEach((d) => {
|
|
5385
5375
|
if (intersection3 === true || intersection3.has(d.id)) {
|