@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/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/CartoDB/carto-api-client#readme",
|
|
9
9
|
"author": "Don McCurdy <donmccurdy@carto.com>",
|
|
10
10
|
"packageManager": "yarn@4.3.1",
|
|
11
|
-
"version": "0.5.
|
|
11
|
+
"version": "0.5.31",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
package/src/fetch-map/source.ts
CHANGED
|
@@ -106,13 +106,13 @@ export function configureSource({
|
|
|
106
106
|
tileResolution,
|
|
107
107
|
...(queryParameters && {queryParameters}),
|
|
108
108
|
} as QuerySourceOptions;
|
|
109
|
-
const {
|
|
109
|
+
const {prepareLabels} = dataset;
|
|
110
110
|
const vectorOptions = {
|
|
111
111
|
spatialDataColumn,
|
|
112
112
|
...(columns && {columns}),
|
|
113
113
|
...(filters && {filters}),
|
|
114
114
|
...(aggregationExp && {aggregationExp}),
|
|
115
|
-
...(
|
|
115
|
+
...(prepareLabels && {prepareLabels}),
|
|
116
116
|
} as VectorTableSourceOptions;
|
|
117
117
|
|
|
118
118
|
if (type === 'raster') {
|
package/src/fetch-map/types.ts
CHANGED
|
@@ -265,7 +265,7 @@ export type Dataset = {
|
|
|
265
265
|
name?: string | null;
|
|
266
266
|
spatialIndex?: string | null;
|
|
267
267
|
exportToBucketAvailable?: boolean;
|
|
268
|
-
|
|
268
|
+
prepareLabels?: boolean;
|
|
269
269
|
};
|
|
270
270
|
|
|
271
271
|
export type AttributeType = 'String' | 'Number' | 'Timestamp' | 'Boolean';
|
package/src/geo.ts
CHANGED
|
@@ -4,10 +4,10 @@ import union from '@turf/union';
|
|
|
4
4
|
import {getType} from '@turf/invariant';
|
|
5
5
|
import {polygon, multiPolygon, feature, featureCollection} from '@turf/helpers';
|
|
6
6
|
import type {BBox, Geometry, MultiPolygon, Polygon, Position} from 'geojson';
|
|
7
|
-
import type {
|
|
7
|
+
import type {GeometrySpatialFilter} from './types.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Returns a {@link
|
|
10
|
+
* Returns a {@link GeometrySpatialFilter} for a given viewport, typically obtained
|
|
11
11
|
* from deck.gl's `viewport.getBounds()` method ([west, south, east, north]).
|
|
12
12
|
* If the viewport covers the entire world (to some margin of error in Web
|
|
13
13
|
* Mercator space), `undefined` is returned instead.
|
|
@@ -17,7 +17,7 @@ import type {SpatialFilter} from './types.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export function createViewportSpatialFilter(
|
|
19
19
|
viewport: BBox
|
|
20
|
-
):
|
|
20
|
+
): GeometrySpatialFilter | undefined {
|
|
21
21
|
if (_isGlobalViewport(viewport)) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -25,14 +25,14 @@ export function createViewportSpatialFilter(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Returns a {@link
|
|
28
|
+
* Returns a {@link GeometrySpatialFilter} for a given {@link Polygon} or
|
|
29
29
|
* {@link MultiPolygon}. If the polygon(s) extend outside longitude
|
|
30
30
|
* range [-180, +180], the result may be reformatted for compatibility
|
|
31
31
|
* with CARTO APIs.
|
|
32
32
|
*/
|
|
33
33
|
export function createPolygonSpatialFilter(
|
|
34
34
|
spatialFilter: Polygon | MultiPolygon
|
|
35
|
-
):
|
|
35
|
+
): GeometrySpatialFilter | undefined {
|
|
36
36
|
return (spatialFilter && _normalizeGeometry(spatialFilter)) || undefined;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -30,7 +30,7 @@ export type VectorQuerySourceOptions = SourceOptions &
|
|
|
30
30
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
31
31
|
* stable label positions for polygons that span multiple tiles.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
prepareLabels?: boolean;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
type UrlParameters = {
|
|
@@ -59,7 +59,7 @@ export const vectorQuerySource = async function (
|
|
|
59
59
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
60
60
|
queryParameters,
|
|
61
61
|
aggregationExp,
|
|
62
|
-
|
|
62
|
+
prepareLabels,
|
|
63
63
|
} = options;
|
|
64
64
|
|
|
65
65
|
const spatialDataType = 'geo';
|
|
@@ -83,7 +83,7 @@ export const vectorQuerySource = async function (
|
|
|
83
83
|
if (aggregationExp) {
|
|
84
84
|
urlParameters.aggregationExp = aggregationExp;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
86
|
+
if (prepareLabels) {
|
|
87
87
|
urlParameters.featureBbox = true;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -30,7 +30,7 @@ export type VectorTableSourceOptions = SourceOptions &
|
|
|
30
30
|
* a `"west,south,east,north"` string in WGS84. Used by clients to compute
|
|
31
31
|
* stable label positions for polygons that span multiple tiles.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
prepareLabels?: boolean;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
type UrlParameters = {
|
|
@@ -57,7 +57,7 @@ export const vectorTableSource = async function (
|
|
|
57
57
|
tableName,
|
|
58
58
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
59
59
|
aggregationExp,
|
|
60
|
-
|
|
60
|
+
prepareLabels,
|
|
61
61
|
} = options;
|
|
62
62
|
|
|
63
63
|
const spatialDataType = 'geo';
|
|
@@ -78,7 +78,7 @@ export const vectorTableSource = async function (
|
|
|
78
78
|
if (aggregationExp) {
|
|
79
79
|
urlParameters.aggregationExp = aggregationExp;
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
81
|
+
if (prepareLabels) {
|
|
82
82
|
urlParameters.featureBbox = true;
|
|
83
83
|
}
|
|
84
84
|
|