@carto/api-client 0.5.28 → 0.5.30-alpha.143d135.117
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/CHANGELOG.md +8 -0
- package/build/api-client.cjs +37 -6
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +49 -10
- package/build/api-client.d.ts +49 -10
- package/build/api-client.js +36 -6
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +9 -3
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +9 -3
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/fetch-map.ts +22 -0
- package/src/fetch-map/source.ts +2 -0
- package/src/fetch-map/types.ts +1 -0
- package/src/filters/geosjonFeatures.ts +2 -2
- package/src/filters/tileFeatures.ts +2 -2
- package/src/filters/tileFeaturesGeometries.ts +3 -3
- package/src/filters/tileFeaturesRaster.ts +2 -2
- package/src/filters/tileFeaturesSpatialIndex.ts +2 -2
- package/src/filters/tileIntersection.ts +7 -7
- package/src/sources/vector-query-source.ts +14 -1
- package/src/sources/vector-table-source.ts +14 -1
- package/src/types.ts +30 -1
- package/src/widget-sources/widget-tileset-source-impl.ts +25 -8
- package/src/widget-sources/widget-tileset-source.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### 0.5.30
|
|
6
|
+
|
|
7
|
+
- feat(widgetSources): support `SpatialIndexFilter` (H3/Quadbin cell selection) on `spatialFilter` (#296)
|
|
8
|
+
|
|
9
|
+
### 0.5.29
|
|
10
|
+
|
|
11
|
+
- feat(sources): Support featureBbox parameter (#289)
|
|
12
|
+
|
|
5
13
|
### 0.5.28
|
|
6
14
|
|
|
7
15
|
- feat(fetchMap): Support zoom-dependent point styling (#287)
|
package/build/api-client.cjs
CHANGED
|
@@ -185,6 +185,7 @@ __export(src_exports, {
|
|
|
185
185
|
h3TilesetSource: () => h3TilesetSource,
|
|
186
186
|
hasFilter: () => hasFilter,
|
|
187
187
|
histogram: () => histogram,
|
|
188
|
+
isSpatialIndexFilter: () => isSpatialIndexFilter,
|
|
188
189
|
makeIntervalComplete: () => makeIntervalComplete,
|
|
189
190
|
negateAccessor: () => negateAccessor,
|
|
190
191
|
opacityToAlpha: () => opacityToAlpha,
|
|
@@ -5801,6 +5802,9 @@ var SchemaFieldType = /* @__PURE__ */ ((SchemaFieldType2) => {
|
|
|
5801
5802
|
SchemaFieldType2["Unknown"] = "unknown";
|
|
5802
5803
|
return SchemaFieldType2;
|
|
5803
5804
|
})(SchemaFieldType || {});
|
|
5805
|
+
function isSpatialIndexFilter(spatialFilter) {
|
|
5806
|
+
return Array.isArray(spatialFilter.indexes);
|
|
5807
|
+
}
|
|
5804
5808
|
|
|
5805
5809
|
// src/utils.ts
|
|
5806
5810
|
var FILTER_TYPES = new Set(Object.values(FilterType));
|
|
@@ -7666,16 +7670,17 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7666
7670
|
this._features.length = 0;
|
|
7667
7671
|
}
|
|
7668
7672
|
_extractTileFeatures(spatialFilter) {
|
|
7673
|
+
const geometryFilter = spatialFilter && !isSpatialIndexFilter(spatialFilter) ? spatialFilter : void 0;
|
|
7669
7674
|
const prevInputs = this._tileFeatureExtractPreviousInputs;
|
|
7670
|
-
if (this._features.length && spatialFilterEquals(prevInputs.spatialFilter,
|
|
7675
|
+
if (this._features.length && spatialFilterEquals(prevInputs.spatialFilter, geometryFilter)) {
|
|
7671
7676
|
return;
|
|
7672
7677
|
}
|
|
7673
7678
|
this._features = tileFeatures({
|
|
7674
7679
|
...assignOptional({}, this.props, this._tileFeatureExtractOptions),
|
|
7675
7680
|
tiles: this._tiles,
|
|
7676
|
-
spatialFilter
|
|
7681
|
+
spatialFilter: geometryFilter
|
|
7677
7682
|
});
|
|
7678
|
-
prevInputs.spatialFilter =
|
|
7683
|
+
prevInputs.spatialFilter = geometryFilter;
|
|
7679
7684
|
}
|
|
7680
7685
|
/**
|
|
7681
7686
|
* Loads features as GeoJSON (used for testing).
|
|
@@ -8564,7 +8569,8 @@ var vectorQuerySource = async function(options) {
|
|
|
8564
8569
|
sqlQuery,
|
|
8565
8570
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8566
8571
|
queryParameters,
|
|
8567
|
-
aggregationExp
|
|
8572
|
+
aggregationExp,
|
|
8573
|
+
featureBbox
|
|
8568
8574
|
} = options;
|
|
8569
8575
|
const spatialDataType = "geo";
|
|
8570
8576
|
const urlParameters = {
|
|
@@ -8585,6 +8591,9 @@ var vectorQuerySource = async function(options) {
|
|
|
8585
8591
|
if (aggregationExp) {
|
|
8586
8592
|
urlParameters.aggregationExp = aggregationExp;
|
|
8587
8593
|
}
|
|
8594
|
+
if (featureBbox) {
|
|
8595
|
+
urlParameters.featureBbox = true;
|
|
8596
|
+
}
|
|
8588
8597
|
return baseSource("query", options, urlParameters).then(
|
|
8589
8598
|
(result) => ({
|
|
8590
8599
|
...result,
|
|
@@ -8608,7 +8617,8 @@ var vectorTableSource = async function(options) {
|
|
|
8608
8617
|
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8609
8618
|
tableName,
|
|
8610
8619
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8611
|
-
aggregationExp
|
|
8620
|
+
aggregationExp,
|
|
8621
|
+
featureBbox
|
|
8612
8622
|
} = options;
|
|
8613
8623
|
const spatialDataType = "geo";
|
|
8614
8624
|
const urlParameters = {
|
|
@@ -8626,6 +8636,9 @@ var vectorTableSource = async function(options) {
|
|
|
8626
8636
|
if (aggregationExp) {
|
|
8627
8637
|
urlParameters.aggregationExp = aggregationExp;
|
|
8628
8638
|
}
|
|
8639
|
+
if (featureBbox) {
|
|
8640
|
+
urlParameters.featureBbox = true;
|
|
8641
|
+
}
|
|
8629
8642
|
return baseSource("table", options, urlParameters).then(
|
|
8630
8643
|
(result) => ({
|
|
8631
8644
|
...result,
|
|
@@ -11216,11 +11229,13 @@ function configureSource({
|
|
|
11216
11229
|
tileResolution,
|
|
11217
11230
|
...queryParameters && { queryParameters }
|
|
11218
11231
|
};
|
|
11232
|
+
const { featureBbox } = dataset;
|
|
11219
11233
|
const vectorOptions = {
|
|
11220
11234
|
spatialDataColumn,
|
|
11221
11235
|
...columns && { columns },
|
|
11222
11236
|
...filters && { filters },
|
|
11223
|
-
...aggregationExp && { aggregationExp }
|
|
11237
|
+
...aggregationExp && { aggregationExp },
|
|
11238
|
+
...featureBbox && { featureBbox }
|
|
11224
11239
|
};
|
|
11225
11240
|
if (type === "raster") {
|
|
11226
11241
|
return rasterSource({
|
|
@@ -11504,6 +11519,21 @@ async function fetchMap({
|
|
|
11504
11519
|
}
|
|
11505
11520
|
}
|
|
11506
11521
|
});
|
|
11522
|
+
const layers = map.keplerMapConfig.config.visState.layers;
|
|
11523
|
+
const datasetsWithLabels = /* @__PURE__ */ new Set();
|
|
11524
|
+
for (const layer of layers) {
|
|
11525
|
+
const hasTextLabel = layer.config?.textLabel?.some(
|
|
11526
|
+
(t) => t.field?.name
|
|
11527
|
+
);
|
|
11528
|
+
if (hasTextLabel) {
|
|
11529
|
+
datasetsWithLabels.add(layer.config.dataId);
|
|
11530
|
+
}
|
|
11531
|
+
}
|
|
11532
|
+
map.datasets.forEach((dataset) => {
|
|
11533
|
+
if (datasetsWithLabels.has(dataset.id) && (dataset.type === "table" || dataset.type === "query")) {
|
|
11534
|
+
dataset.featureBbox = true;
|
|
11535
|
+
}
|
|
11536
|
+
});
|
|
11507
11537
|
const [basemap] = await Promise.all([
|
|
11508
11538
|
fetchBasemapProps({ config: map.keplerMapConfig.config, errorContext }),
|
|
11509
11539
|
// Mutates map.datasets so that dataset.data contains data
|
|
@@ -11810,6 +11840,7 @@ function hashBuckets(initialCount) {
|
|
|
11810
11840
|
h3TilesetSource,
|
|
11811
11841
|
hasFilter,
|
|
11812
11842
|
histogram,
|
|
11843
|
+
isSpatialIndexFilter,
|
|
11813
11844
|
makeIntervalComplete,
|
|
11814
11845
|
negateAccessor,
|
|
11815
11846
|
opacityToAlpha,
|