@carto/api-client 0.5.30 → 0.5.31
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 +5 -0
- package/build/api-client.cjs +7 -7
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +7 -7
- package/build/api-client.d.ts +7 -7
- package/build/api-client.js +7 -7
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/fetch-map.ts +1 -1
- package/src/fetch-map/source.ts +2 -2
- package/src/fetch-map/types.ts +1 -1
- package/src/geo.ts +5 -5
- package/src/sources/vector-query-source.ts +3 -3
- package/src/sources/vector-table-source.ts +3 -3
package/build/api-client.d.cts
CHANGED
|
@@ -1108,7 +1108,7 @@ type Dataset = {
|
|
|
1108
1108
|
name?: string | null;
|
|
1109
1109
|
spatialIndex?: string | null;
|
|
1110
1110
|
exportToBucketAvailable?: boolean;
|
|
1111
|
-
|
|
1111
|
+
prepareLabels?: boolean;
|
|
1112
1112
|
};
|
|
1113
1113
|
|
|
1114
1114
|
type StyleLayerGroupSlug = 'label' | 'road' | 'border' | 'building' | 'water' | 'land';
|
|
@@ -1370,7 +1370,7 @@ declare function getFilter<T extends FilterType>(filters: Record<string, Filter>
|
|
|
1370
1370
|
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1371
1371
|
|
|
1372
1372
|
/**
|
|
1373
|
-
* Returns a {@link
|
|
1373
|
+
* Returns a {@link GeometrySpatialFilter} for a given viewport, typically obtained
|
|
1374
1374
|
* from deck.gl's `viewport.getBounds()` method ([west, south, east, north]).
|
|
1375
1375
|
* If the viewport covers the entire world (to some margin of error in Web
|
|
1376
1376
|
* Mercator space), `undefined` is returned instead.
|
|
@@ -1378,14 +1378,14 @@ declare function getApplicableFilters(owner?: string, filters?: Record<string, F
|
|
|
1378
1378
|
* If the viewport extends beyond longitude range [-180, +180], the polygon
|
|
1379
1379
|
* may be reformatted for compatibility with CARTO APIs.
|
|
1380
1380
|
*/
|
|
1381
|
-
declare function createViewportSpatialFilter(viewport: BBox):
|
|
1381
|
+
declare function createViewportSpatialFilter(viewport: BBox): GeometrySpatialFilter | undefined;
|
|
1382
1382
|
/**
|
|
1383
|
-
* Returns a {@link
|
|
1383
|
+
* Returns a {@link GeometrySpatialFilter} for a given {@link Polygon} or
|
|
1384
1384
|
* {@link MultiPolygon}. If the polygon(s) extend outside longitude
|
|
1385
1385
|
* range [-180, +180], the result may be reformatted for compatibility
|
|
1386
1386
|
* with CARTO APIs.
|
|
1387
1387
|
*/
|
|
1388
|
-
declare function createPolygonSpatialFilter(spatialFilter: Polygon | MultiPolygon):
|
|
1388
|
+
declare function createPolygonSpatialFilter(spatialFilter: Polygon | MultiPolygon): GeometrySpatialFilter | undefined;
|
|
1389
1389
|
|
|
1390
1390
|
/******************************************************************************
|
|
1391
1391
|
* WIDGET API REQUESTS
|
|
@@ -2092,7 +2092,7 @@ type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptio
|
|
|
2092
2092
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2093
2093
|
* stable label positions for polygons that span multiple tiles.
|
|
2094
2094
|
*/
|
|
2095
|
-
|
|
2095
|
+
prepareLabels?: boolean;
|
|
2096
2096
|
};
|
|
2097
2097
|
type VectorTableSourceResponse = TilejsonResult & WidgetTableSourceResult;
|
|
2098
2098
|
declare const vectorTableSource: (options: VectorTableSourceOptions) => Promise<VectorTableSourceResponse>;
|
|
@@ -2104,7 +2104,7 @@ type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptio
|
|
|
2104
2104
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2105
2105
|
* stable label positions for polygons that span multiple tiles.
|
|
2106
2106
|
*/
|
|
2107
|
-
|
|
2107
|
+
prepareLabels?: boolean;
|
|
2108
2108
|
};
|
|
2109
2109
|
type VectorQuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
2110
2110
|
declare const vectorQuerySource: (options: VectorQuerySourceOptions) => Promise<VectorQuerySourceResponse>;
|
package/build/api-client.d.ts
CHANGED
|
@@ -1108,7 +1108,7 @@ type Dataset = {
|
|
|
1108
1108
|
name?: string | null;
|
|
1109
1109
|
spatialIndex?: string | null;
|
|
1110
1110
|
exportToBucketAvailable?: boolean;
|
|
1111
|
-
|
|
1111
|
+
prepareLabels?: boolean;
|
|
1112
1112
|
};
|
|
1113
1113
|
|
|
1114
1114
|
type StyleLayerGroupSlug = 'label' | 'road' | 'border' | 'building' | 'water' | 'land';
|
|
@@ -1370,7 +1370,7 @@ declare function getFilter<T extends FilterType>(filters: Record<string, Filter>
|
|
|
1370
1370
|
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1371
1371
|
|
|
1372
1372
|
/**
|
|
1373
|
-
* Returns a {@link
|
|
1373
|
+
* Returns a {@link GeometrySpatialFilter} for a given viewport, typically obtained
|
|
1374
1374
|
* from deck.gl's `viewport.getBounds()` method ([west, south, east, north]).
|
|
1375
1375
|
* If the viewport covers the entire world (to some margin of error in Web
|
|
1376
1376
|
* Mercator space), `undefined` is returned instead.
|
|
@@ -1378,14 +1378,14 @@ declare function getApplicableFilters(owner?: string, filters?: Record<string, F
|
|
|
1378
1378
|
* If the viewport extends beyond longitude range [-180, +180], the polygon
|
|
1379
1379
|
* may be reformatted for compatibility with CARTO APIs.
|
|
1380
1380
|
*/
|
|
1381
|
-
declare function createViewportSpatialFilter(viewport: BBox):
|
|
1381
|
+
declare function createViewportSpatialFilter(viewport: BBox): GeometrySpatialFilter | undefined;
|
|
1382
1382
|
/**
|
|
1383
|
-
* Returns a {@link
|
|
1383
|
+
* Returns a {@link GeometrySpatialFilter} for a given {@link Polygon} or
|
|
1384
1384
|
* {@link MultiPolygon}. If the polygon(s) extend outside longitude
|
|
1385
1385
|
* range [-180, +180], the result may be reformatted for compatibility
|
|
1386
1386
|
* with CARTO APIs.
|
|
1387
1387
|
*/
|
|
1388
|
-
declare function createPolygonSpatialFilter(spatialFilter: Polygon | MultiPolygon):
|
|
1388
|
+
declare function createPolygonSpatialFilter(spatialFilter: Polygon | MultiPolygon): GeometrySpatialFilter | undefined;
|
|
1389
1389
|
|
|
1390
1390
|
/******************************************************************************
|
|
1391
1391
|
* WIDGET API REQUESTS
|
|
@@ -2092,7 +2092,7 @@ type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptio
|
|
|
2092
2092
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2093
2093
|
* stable label positions for polygons that span multiple tiles.
|
|
2094
2094
|
*/
|
|
2095
|
-
|
|
2095
|
+
prepareLabels?: boolean;
|
|
2096
2096
|
};
|
|
2097
2097
|
type VectorTableSourceResponse = TilejsonResult & WidgetTableSourceResult;
|
|
2098
2098
|
declare const vectorTableSource: (options: VectorTableSourceOptions) => Promise<VectorTableSourceResponse>;
|
|
@@ -2104,7 +2104,7 @@ type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptio
|
|
|
2104
2104
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
2105
2105
|
* stable label positions for polygons that span multiple tiles.
|
|
2106
2106
|
*/
|
|
2107
|
-
|
|
2107
|
+
prepareLabels?: boolean;
|
|
2108
2108
|
};
|
|
2109
2109
|
type VectorQuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
2110
2110
|
declare const vectorQuerySource: (options: VectorQuerySourceOptions) => Promise<VectorQuerySourceResponse>;
|
package/build/api-client.js
CHANGED
|
@@ -8332,7 +8332,7 @@ var vectorQuerySource = async function(options) {
|
|
|
8332
8332
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8333
8333
|
queryParameters,
|
|
8334
8334
|
aggregationExp,
|
|
8335
|
-
|
|
8335
|
+
prepareLabels
|
|
8336
8336
|
} = options;
|
|
8337
8337
|
const spatialDataType = "geo";
|
|
8338
8338
|
const urlParameters = {
|
|
@@ -8353,7 +8353,7 @@ var vectorQuerySource = async function(options) {
|
|
|
8353
8353
|
if (aggregationExp) {
|
|
8354
8354
|
urlParameters.aggregationExp = aggregationExp;
|
|
8355
8355
|
}
|
|
8356
|
-
if (
|
|
8356
|
+
if (prepareLabels) {
|
|
8357
8357
|
urlParameters.featureBbox = true;
|
|
8358
8358
|
}
|
|
8359
8359
|
return baseSource("query", options, urlParameters).then(
|
|
@@ -8379,7 +8379,7 @@ var vectorTableSource = async function(options) {
|
|
|
8379
8379
|
tableName,
|
|
8380
8380
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8381
8381
|
aggregationExp,
|
|
8382
|
-
|
|
8382
|
+
prepareLabels
|
|
8383
8383
|
} = options;
|
|
8384
8384
|
const spatialDataType = "geo";
|
|
8385
8385
|
const urlParameters = {
|
|
@@ -8397,7 +8397,7 @@ var vectorTableSource = async function(options) {
|
|
|
8397
8397
|
if (aggregationExp) {
|
|
8398
8398
|
urlParameters.aggregationExp = aggregationExp;
|
|
8399
8399
|
}
|
|
8400
|
-
if (
|
|
8400
|
+
if (prepareLabels) {
|
|
8401
8401
|
urlParameters.featureBbox = true;
|
|
8402
8402
|
}
|
|
8403
8403
|
return baseSource("table", options, urlParameters).then(
|
|
@@ -10963,13 +10963,13 @@ function configureSource({
|
|
|
10963
10963
|
tileResolution,
|
|
10964
10964
|
...queryParameters && { queryParameters }
|
|
10965
10965
|
};
|
|
10966
|
-
const {
|
|
10966
|
+
const { prepareLabels } = dataset;
|
|
10967
10967
|
const vectorOptions = {
|
|
10968
10968
|
spatialDataColumn,
|
|
10969
10969
|
...columns && { columns },
|
|
10970
10970
|
...filters && { filters },
|
|
10971
10971
|
...aggregationExp && { aggregationExp },
|
|
10972
|
-
...
|
|
10972
|
+
...prepareLabels && { prepareLabels }
|
|
10973
10973
|
};
|
|
10974
10974
|
if (type === "raster") {
|
|
10975
10975
|
return rasterSource({
|
|
@@ -11265,7 +11265,7 @@ async function fetchMap({
|
|
|
11265
11265
|
}
|
|
11266
11266
|
map.datasets.forEach((dataset) => {
|
|
11267
11267
|
if (datasetsWithLabels.has(dataset.id) && (dataset.type === "table" || dataset.type === "query")) {
|
|
11268
|
-
dataset.
|
|
11268
|
+
dataset.prepareLabels = true;
|
|
11269
11269
|
}
|
|
11270
11270
|
});
|
|
11271
11271
|
const [basemap] = await Promise.all([
|