@carto/api-client 0.5.28 → 0.5.29
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 +4 -0
- package/build/api-client.cjs +28 -3
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +19 -2
- package/build/api-client.d.ts +19 -2
- package/build/api-client.js +28 -3
- package/build/api-client.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/sources/vector-query-source.ts +14 -1
- package/src/sources/vector-table-source.ts +14 -1
package/build/api-client.d.cts
CHANGED
|
@@ -1040,6 +1040,7 @@ type Dataset = {
|
|
|
1040
1040
|
name?: string | null;
|
|
1041
1041
|
spatialIndex?: string | null;
|
|
1042
1042
|
exportToBucketAvailable?: boolean;
|
|
1043
|
+
featureBbox?: boolean;
|
|
1043
1044
|
};
|
|
1044
1045
|
|
|
1045
1046
|
type StyleLayerGroupSlug = 'label' | 'road' | 'border' | 'building' | 'water' | 'land';
|
|
@@ -1993,11 +1994,27 @@ type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
|
1993
1994
|
type VectorTilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
|
|
1994
1995
|
declare const vectorTilesetSource: (options: VectorTilesetSourceOptions) => Promise<VectorTilesetSourceResponse>;
|
|
1995
1996
|
|
|
1996
|
-
type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions & ColumnsOption
|
|
1997
|
+
type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions & ColumnsOption & {
|
|
1998
|
+
/**
|
|
1999
|
+
* If `true`, the server includes a `_carto_bbox` property on each polygon
|
|
2000
|
+
* feature, containing the bounding box of the full (unclipped) geometry as
|
|
2001
|
+
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2002
|
+
* stable label positions for polygons that span multiple tiles.
|
|
2003
|
+
*/
|
|
2004
|
+
featureBbox?: boolean;
|
|
2005
|
+
};
|
|
1997
2006
|
type VectorTableSourceResponse = TilejsonResult & WidgetTableSourceResult;
|
|
1998
2007
|
declare const vectorTableSource: (options: VectorTableSourceOptions) => Promise<VectorTableSourceResponse>;
|
|
1999
2008
|
|
|
2000
|
-
type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptions & ColumnsOption
|
|
2009
|
+
type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptions & ColumnsOption & {
|
|
2010
|
+
/**
|
|
2011
|
+
* If `true`, the server includes a `_carto_bbox` property on each polygon
|
|
2012
|
+
* feature, containing the bounding box of the full (unclipped) geometry as
|
|
2013
|
+
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2014
|
+
* stable label positions for polygons that span multiple tiles.
|
|
2015
|
+
*/
|
|
2016
|
+
featureBbox?: boolean;
|
|
2017
|
+
};
|
|
2001
2018
|
type VectorQuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
2002
2019
|
declare const vectorQuerySource: (options: VectorQuerySourceOptions) => Promise<VectorQuerySourceResponse>;
|
|
2003
2020
|
|
package/build/api-client.d.ts
CHANGED
|
@@ -1040,6 +1040,7 @@ type Dataset = {
|
|
|
1040
1040
|
name?: string | null;
|
|
1041
1041
|
spatialIndex?: string | null;
|
|
1042
1042
|
exportToBucketAvailable?: boolean;
|
|
1043
|
+
featureBbox?: boolean;
|
|
1043
1044
|
};
|
|
1044
1045
|
|
|
1045
1046
|
type StyleLayerGroupSlug = 'label' | 'road' | 'border' | 'building' | 'water' | 'land';
|
|
@@ -1993,11 +1994,27 @@ type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
|
1993
1994
|
type VectorTilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
|
|
1994
1995
|
declare const vectorTilesetSource: (options: VectorTilesetSourceOptions) => Promise<VectorTilesetSourceResponse>;
|
|
1995
1996
|
|
|
1996
|
-
type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions & ColumnsOption
|
|
1997
|
+
type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions & ColumnsOption & {
|
|
1998
|
+
/**
|
|
1999
|
+
* If `true`, the server includes a `_carto_bbox` property on each polygon
|
|
2000
|
+
* feature, containing the bounding box of the full (unclipped) geometry as
|
|
2001
|
+
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2002
|
+
* stable label positions for polygons that span multiple tiles.
|
|
2003
|
+
*/
|
|
2004
|
+
featureBbox?: boolean;
|
|
2005
|
+
};
|
|
1997
2006
|
type VectorTableSourceResponse = TilejsonResult & WidgetTableSourceResult;
|
|
1998
2007
|
declare const vectorTableSource: (options: VectorTableSourceOptions) => Promise<VectorTableSourceResponse>;
|
|
1999
2008
|
|
|
2000
|
-
type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptions & ColumnsOption
|
|
2009
|
+
type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptions & ColumnsOption & {
|
|
2010
|
+
/**
|
|
2011
|
+
* If `true`, the server includes a `_carto_bbox` property on each polygon
|
|
2012
|
+
* feature, containing the bounding box of the full (unclipped) geometry as
|
|
2013
|
+
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2014
|
+
* stable label positions for polygons that span multiple tiles.
|
|
2015
|
+
*/
|
|
2016
|
+
featureBbox?: boolean;
|
|
2017
|
+
};
|
|
2001
2018
|
type VectorQuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
2002
2019
|
declare const vectorQuerySource: (options: VectorQuerySourceOptions) => Promise<VectorQuerySourceResponse>;
|
|
2003
2020
|
|
package/build/api-client.js
CHANGED
|
@@ -8242,7 +8242,8 @@ var vectorQuerySource = async function(options) {
|
|
|
8242
8242
|
sqlQuery,
|
|
8243
8243
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8244
8244
|
queryParameters,
|
|
8245
|
-
aggregationExp
|
|
8245
|
+
aggregationExp,
|
|
8246
|
+
featureBbox
|
|
8246
8247
|
} = options;
|
|
8247
8248
|
const spatialDataType = "geo";
|
|
8248
8249
|
const urlParameters = {
|
|
@@ -8263,6 +8264,9 @@ var vectorQuerySource = async function(options) {
|
|
|
8263
8264
|
if (aggregationExp) {
|
|
8264
8265
|
urlParameters.aggregationExp = aggregationExp;
|
|
8265
8266
|
}
|
|
8267
|
+
if (featureBbox) {
|
|
8268
|
+
urlParameters.featureBbox = true;
|
|
8269
|
+
}
|
|
8266
8270
|
return baseSource("query", options, urlParameters).then(
|
|
8267
8271
|
(result) => ({
|
|
8268
8272
|
...result,
|
|
@@ -8285,7 +8289,8 @@ var vectorTableSource = async function(options) {
|
|
|
8285
8289
|
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8286
8290
|
tableName,
|
|
8287
8291
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8288
|
-
aggregationExp
|
|
8292
|
+
aggregationExp,
|
|
8293
|
+
featureBbox
|
|
8289
8294
|
} = options;
|
|
8290
8295
|
const spatialDataType = "geo";
|
|
8291
8296
|
const urlParameters = {
|
|
@@ -8303,6 +8308,9 @@ var vectorTableSource = async function(options) {
|
|
|
8303
8308
|
if (aggregationExp) {
|
|
8304
8309
|
urlParameters.aggregationExp = aggregationExp;
|
|
8305
8310
|
}
|
|
8311
|
+
if (featureBbox) {
|
|
8312
|
+
urlParameters.featureBbox = true;
|
|
8313
|
+
}
|
|
8306
8314
|
return baseSource("table", options, urlParameters).then(
|
|
8307
8315
|
(result) => ({
|
|
8308
8316
|
...result,
|
|
@@ -10862,11 +10870,13 @@ function configureSource({
|
|
|
10862
10870
|
tileResolution,
|
|
10863
10871
|
...queryParameters && { queryParameters }
|
|
10864
10872
|
};
|
|
10873
|
+
const { featureBbox } = dataset;
|
|
10865
10874
|
const vectorOptions = {
|
|
10866
10875
|
spatialDataColumn,
|
|
10867
10876
|
...columns && { columns },
|
|
10868
10877
|
...filters && { filters },
|
|
10869
|
-
...aggregationExp && { aggregationExp }
|
|
10878
|
+
...aggregationExp && { aggregationExp },
|
|
10879
|
+
...featureBbox && { featureBbox }
|
|
10870
10880
|
};
|
|
10871
10881
|
if (type === "raster") {
|
|
10872
10882
|
return rasterSource({
|
|
@@ -11150,6 +11160,21 @@ async function fetchMap({
|
|
|
11150
11160
|
}
|
|
11151
11161
|
}
|
|
11152
11162
|
});
|
|
11163
|
+
const layers = map.keplerMapConfig.config.visState.layers;
|
|
11164
|
+
const datasetsWithLabels = /* @__PURE__ */ new Set();
|
|
11165
|
+
for (const layer of layers) {
|
|
11166
|
+
const hasTextLabel = layer.config?.textLabel?.some(
|
|
11167
|
+
(t) => t.field?.name
|
|
11168
|
+
);
|
|
11169
|
+
if (hasTextLabel) {
|
|
11170
|
+
datasetsWithLabels.add(layer.config.dataId);
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
map.datasets.forEach((dataset) => {
|
|
11174
|
+
if (datasetsWithLabels.has(dataset.id) && (dataset.type === "table" || dataset.type === "query")) {
|
|
11175
|
+
dataset.featureBbox = true;
|
|
11176
|
+
}
|
|
11177
|
+
});
|
|
11153
11178
|
const [basemap] = await Promise.all([
|
|
11154
11179
|
fetchBasemapProps({ config: map.keplerMapConfig.config, errorContext }),
|
|
11155
11180
|
// Mutates map.datasets so that dataset.data contains data
|