@carto/api-client 0.5.30-alpha.bdcd62f.119 → 0.5.30-alpha.e460f66.121
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 -1
- package/build/api-client.cjs +57 -19
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +21 -19
- package/build/api-client.d.ts +21 -19
- package/build/api-client.js +56 -18
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/layer-map.ts +20 -0
- package/src/fetch-map/parse-map.ts +62 -10
- package/src/fetch-map/types.ts +19 -0
- package/src/index.ts +0 -1
- package/src/spatial-index.ts +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
- feat(
|
|
5
|
+
- feat(fetchMap): Support line & polygon stroke dash styles (#297)
|
|
6
|
+
|
|
7
|
+
### 0.5.30
|
|
8
|
+
|
|
6
9
|
- feat(widgetSources): support `featureIds` / `geometryType` request options to filter widget aggregations by a feature selection without relying on the synthetic `_carto_feature_id` column (#294)
|
|
7
10
|
- feat(widgetSources): support `SpatialIndexFilter` (H3/Quadbin cell selection) on `spatialFilter` (#296)
|
|
8
11
|
|
package/build/api-client.cjs
CHANGED
|
@@ -137,7 +137,6 @@ __export(src_exports, {
|
|
|
137
137
|
_fillInTileStats: () => fillInTileStats,
|
|
138
138
|
_getHexagonResolution: () => _getHexagonResolution,
|
|
139
139
|
_getLog10ScaleSteps: () => getLog10ScaleSteps,
|
|
140
|
-
_getPointsAggregationLevel: () => getPointsAggregationLevel,
|
|
141
140
|
_getRasterTileLayerStyleProps: () => getRasterTileLayerStyleProps,
|
|
142
141
|
_validateVecExprSyntax: () => validateVecExprSyntax,
|
|
143
142
|
addFilter: () => addFilter,
|
|
@@ -176,6 +175,7 @@ __export(src_exports, {
|
|
|
176
175
|
getIconUrlAccessor: () => getIconUrlAccessor,
|
|
177
176
|
getLayerDescriptor: () => getLayerDescriptor,
|
|
178
177
|
getLayerProps: () => getLayerProps,
|
|
178
|
+
getLineStyleAccessor: () => getLineStyleAccessor,
|
|
179
179
|
getMaxMarkerSize: () => getMaxMarkerSize,
|
|
180
180
|
getSizeAccessor: () => getSizeAccessor,
|
|
181
181
|
getSorter: () => getSorter,
|
|
@@ -10150,6 +10150,19 @@ function getIconUrlAccessor(field, range, {
|
|
|
10150
10150
|
};
|
|
10151
10151
|
return normalizeAccessor(accessor, data);
|
|
10152
10152
|
}
|
|
10153
|
+
function getLineStyleAccessor(field, range, data) {
|
|
10154
|
+
const fallback = range.othersDashArray ?? [0, 0];
|
|
10155
|
+
const mapping = {};
|
|
10156
|
+
for (const { value, dashArray } of range.dashArrayMap) {
|
|
10157
|
+
mapping[value] = dashArray;
|
|
10158
|
+
}
|
|
10159
|
+
const accessor = (properties) => mapping[properties[field.name]] ?? fallback;
|
|
10160
|
+
return {
|
|
10161
|
+
accessor: normalizeAccessor(accessor, data),
|
|
10162
|
+
domain: range.dashArrayMap.map(({ value }) => value),
|
|
10163
|
+
range: range.dashArrayMap.map(({ dashArray }) => dashArray)
|
|
10164
|
+
};
|
|
10165
|
+
}
|
|
10153
10166
|
function getMaxMarkerSize(visConfig, visualChannels) {
|
|
10154
10167
|
const { radiusRange, radius, sizeMaxPixels } = visConfig;
|
|
10155
10168
|
const { radiusField, sizeField } = visualChannels;
|
|
@@ -10863,6 +10876,10 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10863
10876
|
const result = {};
|
|
10864
10877
|
const updateTriggers = {};
|
|
10865
10878
|
const scales = {};
|
|
10879
|
+
const isVectorTile = layerType === "mvt" || layerType === "tileset";
|
|
10880
|
+
const geometry = data.tilestats?.layers?.[0]?.geometry;
|
|
10881
|
+
const isLine = geometry === "Line" || geometry === "LineString" || geometry === "MultiLineString";
|
|
10882
|
+
const isPolygon = geometry === "Polygon" || geometry === "MultiPolygon";
|
|
10866
10883
|
{
|
|
10867
10884
|
const { colorField, colorScale } = visualChannels;
|
|
10868
10885
|
const { colorRange } = visConfig;
|
|
@@ -11023,6 +11040,43 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
11023
11040
|
};
|
|
11024
11041
|
}
|
|
11025
11042
|
}
|
|
11043
|
+
{
|
|
11044
|
+
const strokeVisible = isLine || isPolygon && Boolean(visConfig.stroked);
|
|
11045
|
+
if (isVectorTile && strokeVisible) {
|
|
11046
|
+
const { lineStyleField, lineStyleScale } = visualChannels;
|
|
11047
|
+
const { lineStyleRange } = visConfig;
|
|
11048
|
+
if (visConfig.lineStyle && visConfig.lineStyle !== "solid") {
|
|
11049
|
+
if (visConfig.lineStyle === "dotted") {
|
|
11050
|
+
result.lineCapRounded = true;
|
|
11051
|
+
}
|
|
11052
|
+
result.lineStyle = visConfig.lineStyle;
|
|
11053
|
+
if (visConfig.dashArray) {
|
|
11054
|
+
result.dashArray = visConfig.dashArray;
|
|
11055
|
+
result.getDashArray = visConfig.dashArray;
|
|
11056
|
+
}
|
|
11057
|
+
}
|
|
11058
|
+
if (lineStyleField && lineStyleScale && lineStyleRange) {
|
|
11059
|
+
const { accessor, ...scaleProps } = getLineStyleAccessor(
|
|
11060
|
+
lineStyleField,
|
|
11061
|
+
lineStyleRange,
|
|
11062
|
+
data
|
|
11063
|
+
);
|
|
11064
|
+
result.getDashArray = accessor;
|
|
11065
|
+
scales.lineStyle = updateTriggers.getDashArray = {
|
|
11066
|
+
field: lineStyleField,
|
|
11067
|
+
type: lineStyleScale,
|
|
11068
|
+
...scaleProps
|
|
11069
|
+
};
|
|
11070
|
+
const dashArrays = [
|
|
11071
|
+
...lineStyleRange.dashArrayMap.map(({ dashArray }) => dashArray),
|
|
11072
|
+
...lineStyleRange.othersDashArray ? [lineStyleRange.othersDashArray] : []
|
|
11073
|
+
];
|
|
11074
|
+
if (dashArrays.some(([dash]) => dash === 0)) {
|
|
11075
|
+
result.lineCapRounded = true;
|
|
11076
|
+
}
|
|
11077
|
+
}
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11026
11080
|
{
|
|
11027
11081
|
const { heightField, heightScale } = visualChannels;
|
|
11028
11082
|
const { enable3d, heightRange } = visConfig;
|
|
@@ -11151,9 +11205,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
11151
11205
|
} = secondaryLabel || {};
|
|
11152
11206
|
result.getText = mainLabel.field && getTextAccessor(mainLabel.field, data);
|
|
11153
11207
|
const getSecondaryText = secondaryField && getTextAccessor(secondaryField, data);
|
|
11154
|
-
|
|
11155
|
-
const isLineOrPolygon = geometry === "Polygon" || geometry === "MultiPolygon" || geometry === "Line" || geometry === "LineString" || geometry === "MultiLineString";
|
|
11156
|
-
if (isLineOrPolygon && (layerType === "tileset" || layerType === "mvt")) {
|
|
11208
|
+
if ((isLine || isPolygon) && isVectorTile) {
|
|
11157
11209
|
const uniqueIdProperty = visConfig.textLabelUniqueIdField;
|
|
11158
11210
|
result.autoLabels = uniqueIdProperty ? { uniqueIdProperty } : true;
|
|
11159
11211
|
result.pointType = "text";
|
|
@@ -11789,20 +11841,6 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
11789
11841
|
Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS)
|
|
11790
11842
|
);
|
|
11791
11843
|
}
|
|
11792
|
-
var DYNAMIC_TILES_POINTS_AGGREGATION_LEVEL = 8;
|
|
11793
|
-
var AGG_LEVEL_CORRECTION_BY_TILE_RESOLUTION = {
|
|
11794
|
-
0.25: -1,
|
|
11795
|
-
0.5: 0,
|
|
11796
|
-
1: 1,
|
|
11797
|
-
2: 2,
|
|
11798
|
-
4: 3
|
|
11799
|
-
};
|
|
11800
|
-
function getPointsAggregationLevel({
|
|
11801
|
-
tileResolution,
|
|
11802
|
-
zoomLevel
|
|
11803
|
-
}) {
|
|
11804
|
-
return zoomLevel + DYNAMIC_TILES_POINTS_AGGREGATION_LEVEL + AGG_LEVEL_CORRECTION_BY_TILE_RESOLUTION[tileResolution];
|
|
11805
|
-
}
|
|
11806
11844
|
|
|
11807
11845
|
// src/utils/CellSet.ts
|
|
11808
11846
|
init_cjs_shims();
|
|
@@ -11900,7 +11938,6 @@ function hashBuckets(initialCount) {
|
|
|
11900
11938
|
_fillInTileStats,
|
|
11901
11939
|
_getHexagonResolution,
|
|
11902
11940
|
_getLog10ScaleSteps,
|
|
11903
|
-
_getPointsAggregationLevel,
|
|
11904
11941
|
_getRasterTileLayerStyleProps,
|
|
11905
11942
|
_validateVecExprSyntax,
|
|
11906
11943
|
addFilter,
|
|
@@ -11939,6 +11976,7 @@ function hashBuckets(initialCount) {
|
|
|
11939
11976
|
getIconUrlAccessor,
|
|
11940
11977
|
getLayerDescriptor,
|
|
11941
11978
|
getLayerProps,
|
|
11979
|
+
getLineStyleAccessor,
|
|
11942
11980
|
getMaxMarkerSize,
|
|
11943
11981
|
getSizeAccessor,
|
|
11944
11982
|
getSorter,
|