@carto/api-client 0.5.1-alpha.0 → 0.5.1-alpha.2
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 +23 -13
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +2 -0
- package/build/api-client.d.ts +2 -0
- package/build/api-client.js +23 -13
- package/build/api-client.js.map +1 -1
- package/build/worker.js +23 -13
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/filters/tileFeatures.ts +2 -0
- package/src/filters/tileFeaturesGeometries.ts +22 -17
- package/src/utils.ts +27 -0
- package/src/widget-sources/widget-tileset-source-impl.ts +7 -3
package/build/api-client.d.cts
CHANGED
|
@@ -1408,6 +1408,8 @@ type TileFeatures = {
|
|
|
1408
1408
|
/** @privateRemarks Source: @carto/react-core */
|
|
1409
1409
|
type TileFeatureExtractOptions = {
|
|
1410
1410
|
storeGeometry?: boolean;
|
|
1411
|
+
spatialDataType?: SpatialDataType;
|
|
1412
|
+
spatialDataColumn?: string;
|
|
1411
1413
|
uniqueIdProperty?: string;
|
|
1412
1414
|
};
|
|
1413
1415
|
/** @privateRemarks Source: @carto/react-core */
|
package/build/api-client.d.ts
CHANGED
|
@@ -1408,6 +1408,8 @@ type TileFeatures = {
|
|
|
1408
1408
|
/** @privateRemarks Source: @carto/react-core */
|
|
1409
1409
|
type TileFeatureExtractOptions = {
|
|
1410
1410
|
storeGeometry?: boolean;
|
|
1411
|
+
spatialDataType?: SpatialDataType;
|
|
1412
|
+
spatialDataColumn?: string;
|
|
1411
1413
|
uniqueIdProperty?: string;
|
|
1412
1414
|
};
|
|
1413
1415
|
/** @privateRemarks Source: @carto/react-core */
|
package/build/api-client.js
CHANGED
|
@@ -10360,7 +10360,6 @@ function tileFeaturesGeometries({
|
|
|
10360
10360
|
continue;
|
|
10361
10361
|
}
|
|
10362
10362
|
const transformedGeometryToIntersect = tileFormat === "mvt" /* MVT */ ? transformToTileCoords(clippedGeometryToIntersect.geometry, bbox2) : clippedGeometryToIntersect.geometry;
|
|
10363
|
-
createIndicesForPoints(tile.data.points);
|
|
10364
10363
|
calculateFeatures({
|
|
10365
10364
|
map,
|
|
10366
10365
|
tileIsFullyVisible,
|
|
@@ -10447,7 +10446,7 @@ function addIntersectedFeaturesInTile({
|
|
|
10447
10446
|
uniqueIdProperty,
|
|
10448
10447
|
options
|
|
10449
10448
|
}) {
|
|
10450
|
-
const indices = getIndices(data);
|
|
10449
|
+
const indices = getIndices(data, type);
|
|
10451
10450
|
const storeGeometry = options?.storeGeometry || false;
|
|
10452
10451
|
for (let i = 0; i < indices.length - 1; i++) {
|
|
10453
10452
|
const startIndex = indices[i];
|
|
@@ -10466,20 +10465,22 @@ function addIntersectedFeaturesInTile({
|
|
|
10466
10465
|
});
|
|
10467
10466
|
}
|
|
10468
10467
|
}
|
|
10469
|
-
function getIndices(data) {
|
|
10468
|
+
function getIndices(data, type) {
|
|
10470
10469
|
let indices;
|
|
10471
|
-
switch (
|
|
10472
|
-
case "
|
|
10473
|
-
indices = data.
|
|
10470
|
+
switch (type) {
|
|
10471
|
+
case "Polygon":
|
|
10472
|
+
indices = data.primitivePolygonIndices;
|
|
10474
10473
|
break;
|
|
10475
10474
|
case "LineString":
|
|
10476
10475
|
indices = data.pathIndices;
|
|
10477
10476
|
break;
|
|
10478
|
-
case "
|
|
10479
|
-
indices = data
|
|
10477
|
+
case "Point":
|
|
10478
|
+
indices = createIndicesForPoints(data);
|
|
10480
10479
|
break;
|
|
10481
10480
|
default:
|
|
10482
|
-
throw new Error(
|
|
10481
|
+
throw new Error(
|
|
10482
|
+
`Unsupported geometry type: ${type}`
|
|
10483
|
+
);
|
|
10483
10484
|
}
|
|
10484
10485
|
return indices.value;
|
|
10485
10486
|
}
|
|
@@ -10586,7 +10587,7 @@ function addAllFeaturesInTile({
|
|
|
10586
10587
|
uniqueIdProperty,
|
|
10587
10588
|
options
|
|
10588
10589
|
}) {
|
|
10589
|
-
const indices = getIndices(data);
|
|
10590
|
+
const indices = getIndices(data, type);
|
|
10590
10591
|
const storeGeometry = options?.storeGeometry || false;
|
|
10591
10592
|
for (let i = 0; i < indices.length - 1; i++) {
|
|
10592
10593
|
const startIndex = indices[i];
|
|
@@ -10614,7 +10615,7 @@ function createIndicesForPoints(data) {
|
|
|
10614
10615
|
};
|
|
10615
10616
|
pointIndices.value.set(featureIds);
|
|
10616
10617
|
pointIndices.value.set([lastFeatureId + 1], featureIds.length);
|
|
10617
|
-
|
|
10618
|
+
return pointIndices;
|
|
10618
10619
|
}
|
|
10619
10620
|
|
|
10620
10621
|
// src/filters/tileFeaturesSpatialIndex.ts
|
|
@@ -10949,6 +10950,16 @@ function isEmptyObject(object) {
|
|
|
10949
10950
|
}
|
|
10950
10951
|
var isObject2 = (x) => x !== null && typeof x === "object";
|
|
10951
10952
|
var isPureObject = (x) => isObject2(x) && x.constructor === {}.constructor;
|
|
10953
|
+
function assignOptional(target, ...sources) {
|
|
10954
|
+
for (const source of sources) {
|
|
10955
|
+
for (const key in source) {
|
|
10956
|
+
if (source[key] !== void 0) {
|
|
10957
|
+
target[key] = source[key];
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10960
|
+
}
|
|
10961
|
+
return target;
|
|
10962
|
+
}
|
|
10952
10963
|
|
|
10953
10964
|
// src/filters/tileFeatures.ts
|
|
10954
10965
|
function tileFeatures({
|
|
@@ -12484,8 +12495,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
12484
12495
|
return;
|
|
12485
12496
|
}
|
|
12486
12497
|
this._features = tileFeatures({
|
|
12487
|
-
...this.props,
|
|
12488
|
-
...this._tileFeatureExtractOptions,
|
|
12498
|
+
...assignOptional({}, this.props, this._tileFeatureExtractOptions),
|
|
12489
12499
|
tiles: this._tiles,
|
|
12490
12500
|
spatialFilter
|
|
12491
12501
|
});
|