@carto/api-client 0.5.5-alpha.0 → 0.5.5
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 +106 -292
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +32 -16
- package/build/api-client.d.ts +32 -16
- package/build/api-client.js +106 -278
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/layer-map.ts +33 -45
- package/src/fetch-map/parse-map.ts +97 -83
- package/src/fetch-map/types.ts +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## 0.5
|
|
4
4
|
|
|
5
|
+
### 0.5.5
|
|
6
|
+
|
|
7
|
+
- feat(fetchmap): Expose legend info from fetchMap (#179)
|
|
8
|
+
- fix(widgets): Fix inference of 'spatialDataColumn' in some table and query widgets (#183)
|
|
9
|
+
|
|
5
10
|
### 0.5.4
|
|
6
11
|
|
|
7
12
|
- fix(widgets): Fix support for 'storeGeometry' on tileset widgets (#181)
|
package/build/api-client.cjs
CHANGED
|
@@ -99,7 +99,6 @@ var require_thenBy_module = __commonJS({
|
|
|
99
99
|
// src/index.ts
|
|
100
100
|
var src_exports = {};
|
|
101
101
|
__export(src_exports, {
|
|
102
|
-
AGGREGATION: () => AGGREGATION,
|
|
103
102
|
ApiVersion: () => ApiVersion,
|
|
104
103
|
BASEMAP: () => basemap_styles_default,
|
|
105
104
|
CartoAPIError: () => CartoAPIError,
|
|
@@ -149,7 +148,6 @@ __export(src_exports, {
|
|
|
149
148
|
getApplicableFilters: () => getApplicableFilters,
|
|
150
149
|
getClient: () => getClient,
|
|
151
150
|
getColorAccessor: () => getColorAccessor,
|
|
152
|
-
getColorValueAccessor: () => getColorValueAccessor,
|
|
153
151
|
getColumnNameFromGeoColumn: () => getColumnNameFromGeoColumn,
|
|
154
152
|
getDataFilterExtensionProps: () => getDataFilterExtensionProps,
|
|
155
153
|
getDefaultAggregationExpColumnAliasForLayerType: () => getDefaultAggregationExpColumnAliasForLayerType,
|
|
@@ -3351,9 +3349,9 @@ function compare(x, y) {
|
|
|
3351
3349
|
for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
|
|
3352
3350
|
return k == l ? 0 : k > l ^ a ? 1 : -1;
|
|
3353
3351
|
}
|
|
3354
|
-
function intCheck(n,
|
|
3355
|
-
if (n <
|
|
3356
|
-
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n <
|
|
3352
|
+
function intCheck(n, min2, max2, name) {
|
|
3353
|
+
if (n < min2 || n > max2 || n !== mathfloor(n)) {
|
|
3354
|
+
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min2 || n > max2 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
3357
3355
|
}
|
|
3358
3356
|
}
|
|
3359
3357
|
function isOdd(n) {
|
|
@@ -6831,11 +6829,11 @@ function min(values, keys, joinOperation) {
|
|
|
6831
6829
|
Infinity
|
|
6832
6830
|
);
|
|
6833
6831
|
}
|
|
6834
|
-
let
|
|
6832
|
+
let min2 = Number.POSITIVE_INFINITY;
|
|
6835
6833
|
for (const value of values) {
|
|
6836
|
-
|
|
6834
|
+
min2 = Math.min(min2, value);
|
|
6837
6835
|
}
|
|
6838
|
-
return
|
|
6836
|
+
return min2;
|
|
6839
6837
|
}
|
|
6840
6838
|
function max(values, keys, joinOperation) {
|
|
6841
6839
|
const normalizedKeys = normalizeKeys(keys);
|
|
@@ -6845,11 +6843,11 @@ function max(values, keys, joinOperation) {
|
|
|
6845
6843
|
-Infinity
|
|
6846
6844
|
);
|
|
6847
6845
|
}
|
|
6848
|
-
let
|
|
6846
|
+
let max2 = Number.NEGATIVE_INFINITY;
|
|
6849
6847
|
for (const value of values) {
|
|
6850
|
-
|
|
6848
|
+
max2 = Math.max(max2, value);
|
|
6851
6849
|
}
|
|
6852
|
-
return
|
|
6850
|
+
return max2;
|
|
6853
6851
|
}
|
|
6854
6852
|
function normalizeKeys(keys) {
|
|
6855
6853
|
return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
|
|
@@ -8415,75 +8413,19 @@ function ascending(a, b) {
|
|
|
8415
8413
|
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
8416
8414
|
}
|
|
8417
8415
|
|
|
8418
|
-
// node_modules/d3-array/src/number.js
|
|
8419
|
-
init_cjs_shims();
|
|
8420
|
-
function* numbers(values, valueof) {
|
|
8421
|
-
if (valueof === void 0) {
|
|
8422
|
-
for (let value of values) {
|
|
8423
|
-
if (value != null && (value = +value) >= value) {
|
|
8424
|
-
yield value;
|
|
8425
|
-
}
|
|
8426
|
-
}
|
|
8427
|
-
} else {
|
|
8428
|
-
let index = -1;
|
|
8429
|
-
for (let value of values) {
|
|
8430
|
-
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
8431
|
-
yield value;
|
|
8432
|
-
}
|
|
8433
|
-
}
|
|
8434
|
-
}
|
|
8435
|
-
}
|
|
8436
|
-
|
|
8437
|
-
// node_modules/d3-array/src/deviation.js
|
|
8438
|
-
init_cjs_shims();
|
|
8439
|
-
|
|
8440
|
-
// node_modules/d3-array/src/variance.js
|
|
8441
|
-
init_cjs_shims();
|
|
8442
|
-
function variance(values, valueof) {
|
|
8443
|
-
let count = 0;
|
|
8444
|
-
let delta;
|
|
8445
|
-
let mean = 0;
|
|
8446
|
-
let sum3 = 0;
|
|
8447
|
-
if (valueof === void 0) {
|
|
8448
|
-
for (let value of values) {
|
|
8449
|
-
if (value != null && (value = +value) >= value) {
|
|
8450
|
-
delta = value - mean;
|
|
8451
|
-
mean += delta / ++count;
|
|
8452
|
-
sum3 += delta * (value - mean);
|
|
8453
|
-
}
|
|
8454
|
-
}
|
|
8455
|
-
} else {
|
|
8456
|
-
let index = -1;
|
|
8457
|
-
for (let value of values) {
|
|
8458
|
-
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
8459
|
-
delta = value - mean;
|
|
8460
|
-
mean += delta / ++count;
|
|
8461
|
-
sum3 += delta * (value - mean);
|
|
8462
|
-
}
|
|
8463
|
-
}
|
|
8464
|
-
}
|
|
8465
|
-
if (count > 1) return sum3 / (count - 1);
|
|
8466
|
-
}
|
|
8467
|
-
|
|
8468
|
-
// node_modules/d3-array/src/deviation.js
|
|
8469
|
-
function deviation(values, valueof) {
|
|
8470
|
-
const v2 = variance(values, valueof);
|
|
8471
|
-
return v2 ? Math.sqrt(v2) : v2;
|
|
8472
|
-
}
|
|
8473
|
-
|
|
8474
8416
|
// node_modules/d3-array/src/extent.js
|
|
8475
8417
|
init_cjs_shims();
|
|
8476
8418
|
function extent(values, valueof) {
|
|
8477
|
-
let
|
|
8478
|
-
let
|
|
8419
|
+
let min2;
|
|
8420
|
+
let max2;
|
|
8479
8421
|
if (valueof === void 0) {
|
|
8480
8422
|
for (const value of values) {
|
|
8481
8423
|
if (value != null) {
|
|
8482
|
-
if (
|
|
8483
|
-
if (value >= value)
|
|
8424
|
+
if (min2 === void 0) {
|
|
8425
|
+
if (value >= value) min2 = max2 = value;
|
|
8484
8426
|
} else {
|
|
8485
|
-
if (
|
|
8486
|
-
if (
|
|
8427
|
+
if (min2 > value) min2 = value;
|
|
8428
|
+
if (max2 < value) max2 = value;
|
|
8487
8429
|
}
|
|
8488
8430
|
}
|
|
8489
8431
|
}
|
|
@@ -8491,16 +8433,16 @@ function extent(values, valueof) {
|
|
|
8491
8433
|
let index = -1;
|
|
8492
8434
|
for (let value of values) {
|
|
8493
8435
|
if ((value = valueof(value, ++index, values)) != null) {
|
|
8494
|
-
if (
|
|
8495
|
-
if (value >= value)
|
|
8436
|
+
if (min2 === void 0) {
|
|
8437
|
+
if (value >= value) min2 = max2 = value;
|
|
8496
8438
|
} else {
|
|
8497
|
-
if (
|
|
8498
|
-
if (
|
|
8439
|
+
if (min2 > value) min2 = value;
|
|
8440
|
+
if (max2 < value) max2 = value;
|
|
8499
8441
|
}
|
|
8500
8442
|
}
|
|
8501
8443
|
}
|
|
8502
8444
|
}
|
|
8503
|
-
return [
|
|
8445
|
+
return [min2, max2];
|
|
8504
8446
|
}
|
|
8505
8447
|
|
|
8506
8448
|
// node_modules/d3-array/src/group.js
|
|
@@ -8634,109 +8576,6 @@ function groupSort(values, reduce, key) {
|
|
|
8634
8576
|
return (reduce.length !== 2 ? sort(rollup(values, reduce, key), ([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)) : sort(group(values, key), ([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))).map(([key2]) => key2);
|
|
8635
8577
|
}
|
|
8636
8578
|
|
|
8637
|
-
// node_modules/d3-array/src/quantile.js
|
|
8638
|
-
init_cjs_shims();
|
|
8639
|
-
|
|
8640
|
-
// node_modules/d3-array/src/max.js
|
|
8641
|
-
init_cjs_shims();
|
|
8642
|
-
function max2(values, valueof) {
|
|
8643
|
-
let max3;
|
|
8644
|
-
if (valueof === void 0) {
|
|
8645
|
-
for (const value of values) {
|
|
8646
|
-
if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
|
|
8647
|
-
max3 = value;
|
|
8648
|
-
}
|
|
8649
|
-
}
|
|
8650
|
-
} else {
|
|
8651
|
-
let index = -1;
|
|
8652
|
-
for (let value of values) {
|
|
8653
|
-
if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
|
|
8654
|
-
max3 = value;
|
|
8655
|
-
}
|
|
8656
|
-
}
|
|
8657
|
-
}
|
|
8658
|
-
return max3;
|
|
8659
|
-
}
|
|
8660
|
-
|
|
8661
|
-
// node_modules/d3-array/src/min.js
|
|
8662
|
-
init_cjs_shims();
|
|
8663
|
-
function min2(values, valueof) {
|
|
8664
|
-
let min3;
|
|
8665
|
-
if (valueof === void 0) {
|
|
8666
|
-
for (const value of values) {
|
|
8667
|
-
if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
|
|
8668
|
-
min3 = value;
|
|
8669
|
-
}
|
|
8670
|
-
}
|
|
8671
|
-
} else {
|
|
8672
|
-
let index = -1;
|
|
8673
|
-
for (let value of values) {
|
|
8674
|
-
if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
|
|
8675
|
-
min3 = value;
|
|
8676
|
-
}
|
|
8677
|
-
}
|
|
8678
|
-
}
|
|
8679
|
-
return min3;
|
|
8680
|
-
}
|
|
8681
|
-
|
|
8682
|
-
// node_modules/d3-array/src/quickselect.js
|
|
8683
|
-
init_cjs_shims();
|
|
8684
|
-
function quickselect(array, k, left = 0, right = Infinity, compare2) {
|
|
8685
|
-
k = Math.floor(k);
|
|
8686
|
-
left = Math.floor(Math.max(0, left));
|
|
8687
|
-
right = Math.floor(Math.min(array.length - 1, right));
|
|
8688
|
-
if (!(left <= k && k <= right)) return array;
|
|
8689
|
-
compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
|
|
8690
|
-
while (right > left) {
|
|
8691
|
-
if (right - left > 600) {
|
|
8692
|
-
const n = right - left + 1;
|
|
8693
|
-
const m = k - left + 1;
|
|
8694
|
-
const z = Math.log(n);
|
|
8695
|
-
const s = 0.5 * Math.exp(2 * z / 3);
|
|
8696
|
-
const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
8697
|
-
const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
8698
|
-
const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
8699
|
-
quickselect(array, k, newLeft, newRight, compare2);
|
|
8700
|
-
}
|
|
8701
|
-
const t = array[k];
|
|
8702
|
-
let i = left;
|
|
8703
|
-
let j = right;
|
|
8704
|
-
swap(array, left, k);
|
|
8705
|
-
if (compare2(array[right], t) > 0) swap(array, left, right);
|
|
8706
|
-
while (i < j) {
|
|
8707
|
-
swap(array, i, j), ++i, --j;
|
|
8708
|
-
while (compare2(array[i], t) < 0) ++i;
|
|
8709
|
-
while (compare2(array[j], t) > 0) --j;
|
|
8710
|
-
}
|
|
8711
|
-
if (compare2(array[left], t) === 0) swap(array, left, j);
|
|
8712
|
-
else ++j, swap(array, j, right);
|
|
8713
|
-
if (j <= k) left = j + 1;
|
|
8714
|
-
if (k <= j) right = j - 1;
|
|
8715
|
-
}
|
|
8716
|
-
return array;
|
|
8717
|
-
}
|
|
8718
|
-
function swap(array, i, j) {
|
|
8719
|
-
const t = array[i];
|
|
8720
|
-
array[i] = array[j];
|
|
8721
|
-
array[j] = t;
|
|
8722
|
-
}
|
|
8723
|
-
|
|
8724
|
-
// node_modules/d3-array/src/quantile.js
|
|
8725
|
-
function quantile(values, p, valueof) {
|
|
8726
|
-
values = Float64Array.from(numbers(values, valueof));
|
|
8727
|
-
if (!(n = values.length) || isNaN(p = +p)) return;
|
|
8728
|
-
if (p <= 0 || n < 2) return min2(values);
|
|
8729
|
-
if (p >= 1) return max2(values);
|
|
8730
|
-
var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max2(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min2(values.subarray(i0 + 1));
|
|
8731
|
-
return value0 + (value1 - value0) * (i - i0);
|
|
8732
|
-
}
|
|
8733
|
-
|
|
8734
|
-
// node_modules/d3-array/src/median.js
|
|
8735
|
-
init_cjs_shims();
|
|
8736
|
-
function median(values, valueof) {
|
|
8737
|
-
return quantile(values, 0.5, valueof);
|
|
8738
|
-
}
|
|
8739
|
-
|
|
8740
8579
|
// node_modules/d3-color/src/index.js
|
|
8741
8580
|
init_cjs_shims();
|
|
8742
8581
|
|
|
@@ -9031,12 +8870,12 @@ function hslConvert(o) {
|
|
|
9031
8870
|
if (!o) return new Hsl();
|
|
9032
8871
|
if (o instanceof Hsl) return o;
|
|
9033
8872
|
o = o.rgb();
|
|
9034
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255,
|
|
8873
|
+
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
|
|
9035
8874
|
if (s) {
|
|
9036
|
-
if (r ===
|
|
9037
|
-
else if (g ===
|
|
8875
|
+
if (r === max2) h = (g - b) / s + (g < b) * 6;
|
|
8876
|
+
else if (g === max2) h = (b - r) / s + 2;
|
|
9038
8877
|
else h = (r - g) / s + 4;
|
|
9039
|
-
s /= l < 0.5 ?
|
|
8878
|
+
s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
|
|
9040
8879
|
h *= 60;
|
|
9041
8880
|
} else {
|
|
9042
8881
|
s = l > 0 && l < 1 ? 0 : h;
|
|
@@ -9176,25 +9015,11 @@ function identity2(v2) {
|
|
|
9176
9015
|
return v2;
|
|
9177
9016
|
}
|
|
9178
9017
|
var UNKNOWN_COLOR = "#868d91";
|
|
9179
|
-
var AGGREGATION = {
|
|
9180
|
-
average: "MEAN",
|
|
9181
|
-
maximum: "MAX",
|
|
9182
|
-
minimum: "MIN",
|
|
9183
|
-
sum: "SUM"
|
|
9184
|
-
};
|
|
9185
9018
|
var OPACITY_MAP = {
|
|
9186
9019
|
getFillColor: "opacity",
|
|
9187
9020
|
getLineColor: "strokeOpacity",
|
|
9188
9021
|
getTextColor: "opacity"
|
|
9189
9022
|
};
|
|
9190
|
-
var AGGREGATION_FUNC = {
|
|
9191
|
-
"count unique": (values, accessor) => groupSort(values, (v2) => v2.length, accessor).length,
|
|
9192
|
-
median,
|
|
9193
|
-
// Unfortunately mode() is only available in d3-array@3+ which is ESM only
|
|
9194
|
-
mode: (values, accessor) => groupSort(values, (v2) => v2.length, accessor).pop(),
|
|
9195
|
-
stddev: deviation,
|
|
9196
|
-
variance
|
|
9197
|
-
};
|
|
9198
9023
|
var hexToRGBA = (c) => {
|
|
9199
9024
|
const { r, g, b, opacity } = rgb(c);
|
|
9200
9025
|
return [r, g, b, 255 * opacity];
|
|
@@ -9290,11 +9115,11 @@ function domainFromAttribute(attribute, scaleType, scaleLength) {
|
|
|
9290
9115
|
if (scaleType === "quantile" && attribute.quantiles) {
|
|
9291
9116
|
return attribute.quantiles.global ? attribute.quantiles.global[scaleLength] : attribute.quantiles[scaleLength];
|
|
9292
9117
|
}
|
|
9293
|
-
let { min:
|
|
9294
|
-
if (scaleType === "log" &&
|
|
9295
|
-
|
|
9118
|
+
let { min: min2 } = attribute;
|
|
9119
|
+
if (scaleType === "log" && min2 === 0) {
|
|
9120
|
+
min2 = 1e-5;
|
|
9296
9121
|
}
|
|
9297
|
-
return [
|
|
9122
|
+
return [min2, attribute.max];
|
|
9298
9123
|
}
|
|
9299
9124
|
function domainFromValues(values, scaleType) {
|
|
9300
9125
|
if (scaleType === "ordinal" || scaleType === "point") {
|
|
@@ -9352,11 +9177,6 @@ function findAccessorKey(keys, properties) {
|
|
|
9352
9177
|
}
|
|
9353
9178
|
return keys;
|
|
9354
9179
|
}
|
|
9355
|
-
function getColorValueAccessor({ name }, colorAggregation, data) {
|
|
9356
|
-
const aggregator = AGGREGATION_FUNC[colorAggregation];
|
|
9357
|
-
const accessor = (values) => aggregator(values, (p) => p[name]);
|
|
9358
|
-
return normalizeAccessor(accessor, data);
|
|
9359
|
-
}
|
|
9360
9180
|
function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
|
|
9361
9181
|
const scale2 = calculateLayerScale(
|
|
9362
9182
|
colorColumn || name,
|
|
@@ -9374,7 +9194,7 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
|
|
|
9374
9194
|
const { r, g, b } = rgb(scale2(propertyValue));
|
|
9375
9195
|
return [r, g, b, propertyValue === null ? 0 : alpha];
|
|
9376
9196
|
};
|
|
9377
|
-
return normalizeAccessor(accessor, data);
|
|
9197
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9378
9198
|
}
|
|
9379
9199
|
function calculateLayerScale(name, scaleType, range, data) {
|
|
9380
9200
|
const scale2 = SCALE_FUNCS[scaleType]();
|
|
@@ -9461,7 +9281,7 @@ function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
|
|
|
9461
9281
|
const propertyValue = properties[accessorKeys[0]];
|
|
9462
9282
|
return scale2(propertyValue);
|
|
9463
9283
|
};
|
|
9464
|
-
return normalizeAccessor(accessor, data);
|
|
9284
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9465
9285
|
}
|
|
9466
9286
|
var FORMATS = {
|
|
9467
9287
|
date: formatDate,
|
|
@@ -9478,10 +9298,10 @@ function getTextAccessor({ name, type }, data) {
|
|
|
9478
9298
|
return normalizeAccessor(accessor, data);
|
|
9479
9299
|
}
|
|
9480
9300
|
function calculateClusterRadius(properties, stats, radiusRange, column) {
|
|
9481
|
-
const { min:
|
|
9301
|
+
const { min: min2, max: max2 } = stats[column];
|
|
9482
9302
|
const value = properties[column];
|
|
9483
|
-
if (
|
|
9484
|
-
const normalizedValue = (value -
|
|
9303
|
+
if (min2 === max2) return radiusRange[1];
|
|
9304
|
+
const normalizedValue = (value - min2) / (max2 - min2);
|
|
9485
9305
|
return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
|
|
9486
9306
|
}
|
|
9487
9307
|
function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, schema) {
|
|
@@ -9542,6 +9362,14 @@ function parseMap(json) {
|
|
|
9542
9362
|
assert2(data, `No data loaded for dataId: ${dataId}`);
|
|
9543
9363
|
const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config3, dataset);
|
|
9544
9364
|
const styleProps = createStyleProps(config3, propMap);
|
|
9365
|
+
const { channelProps, scales } = createChannelProps(
|
|
9366
|
+
id,
|
|
9367
|
+
type,
|
|
9368
|
+
config3,
|
|
9369
|
+
visualChannels,
|
|
9370
|
+
data,
|
|
9371
|
+
dataset
|
|
9372
|
+
);
|
|
9545
9373
|
const layer = {
|
|
9546
9374
|
type,
|
|
9547
9375
|
filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[dataId],
|
|
@@ -9551,22 +9379,15 @@ function parseMap(json) {
|
|
|
9551
9379
|
...defaultProps2,
|
|
9552
9380
|
...createInteractionProps(interactionConfig),
|
|
9553
9381
|
...styleProps,
|
|
9554
|
-
...
|
|
9555
|
-
id,
|
|
9556
|
-
type,
|
|
9557
|
-
config3,
|
|
9558
|
-
visualChannels,
|
|
9559
|
-
data,
|
|
9560
|
-
dataset
|
|
9561
|
-
),
|
|
9562
|
-
// Must come after style
|
|
9382
|
+
...channelProps,
|
|
9563
9383
|
...createParametersProp(
|
|
9564
9384
|
layerBlending,
|
|
9565
9385
|
styleProps.parameters || {}
|
|
9566
9386
|
),
|
|
9567
9387
|
// Must come after style
|
|
9568
9388
|
...createLoadOptions(token)
|
|
9569
|
-
}
|
|
9389
|
+
},
|
|
9390
|
+
scales
|
|
9570
9391
|
};
|
|
9571
9392
|
return layer;
|
|
9572
9393
|
} catch (e) {
|
|
@@ -9633,69 +9454,47 @@ function createStyleProps(config2, mapping) {
|
|
|
9633
9454
|
result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
|
|
9634
9455
|
return result;
|
|
9635
9456
|
}
|
|
9636
|
-
function
|
|
9457
|
+
function domainAndRangeFromScale(scale2) {
|
|
9458
|
+
return {
|
|
9459
|
+
domain: scale2.domain(),
|
|
9460
|
+
range: scale2.range()
|
|
9461
|
+
};
|
|
9462
|
+
}
|
|
9463
|
+
function createChannelProps(id, layerType, config2, visualChannels, data, dataset) {
|
|
9637
9464
|
const {
|
|
9638
9465
|
colorField,
|
|
9639
9466
|
colorScale,
|
|
9640
9467
|
radiusField,
|
|
9641
9468
|
radiusScale,
|
|
9642
|
-
sizeField,
|
|
9643
|
-
sizeScale,
|
|
9644
9469
|
strokeColorField,
|
|
9645
9470
|
strokeColorScale,
|
|
9646
9471
|
weightField
|
|
9647
9472
|
} = visualChannels;
|
|
9648
|
-
|
|
9649
|
-
if (type === "hexagonId") {
|
|
9650
|
-
heightField = sizeField;
|
|
9651
|
-
heightScale = sizeScale;
|
|
9652
|
-
}
|
|
9473
|
+
const { heightField, heightScale } = visualChannels;
|
|
9653
9474
|
const { textLabel, visConfig } = config2;
|
|
9654
9475
|
const result = {};
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
if (colorField) {
|
|
9658
|
-
const { colorAggregation } = config2.visConfig;
|
|
9659
|
-
if (!AGGREGATION[colorAggregation]) {
|
|
9660
|
-
result.getColorValue = getColorValueAccessor(
|
|
9661
|
-
colorField,
|
|
9662
|
-
colorAggregation,
|
|
9663
|
-
data
|
|
9664
|
-
);
|
|
9665
|
-
} else {
|
|
9666
|
-
result.getColorWeight = (d) => d[colorField.name];
|
|
9667
|
-
}
|
|
9668
|
-
}
|
|
9669
|
-
} else if (colorField) {
|
|
9476
|
+
const scales = {};
|
|
9477
|
+
if (colorField) {
|
|
9670
9478
|
const { colorAggregation: aggregation, colorRange: range } = visConfig;
|
|
9671
|
-
|
|
9479
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9672
9480
|
colorField,
|
|
9673
|
-
// @ts-ignore
|
|
9674
9481
|
colorScale,
|
|
9675
9482
|
{ aggregation, range },
|
|
9676
9483
|
visConfig.opacity,
|
|
9677
9484
|
data
|
|
9678
9485
|
);
|
|
9486
|
+
result.getFillColor = accessor;
|
|
9487
|
+
scales.fillColor = {
|
|
9488
|
+
field: colorField,
|
|
9489
|
+
type: colorScale,
|
|
9490
|
+
...domainAndRangeFromScale(scale2)
|
|
9491
|
+
};
|
|
9492
|
+
} else if (visConfig.filled) {
|
|
9493
|
+
scales.fillColor = {};
|
|
9679
9494
|
}
|
|
9680
|
-
if (
|
|
9681
|
-
const altitude = config2.columns?.altitude;
|
|
9682
|
-
if (altitude) {
|
|
9683
|
-
result.dataTransform = (data2) => {
|
|
9684
|
-
data2.features.forEach(
|
|
9685
|
-
({ geometry, properties }) => {
|
|
9686
|
-
const { type: type2, coordinates } = geometry;
|
|
9687
|
-
if (type2 === "Point") {
|
|
9688
|
-
coordinates[2] = properties[altitude];
|
|
9689
|
-
}
|
|
9690
|
-
}
|
|
9691
|
-
);
|
|
9692
|
-
return data2;
|
|
9693
|
-
};
|
|
9694
|
-
}
|
|
9695
|
-
}
|
|
9696
|
-
if (type === "clusterTile") {
|
|
9495
|
+
if (layerType === "clusterTile") {
|
|
9697
9496
|
const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
|
|
9698
|
-
|
|
9497
|
+
layerType,
|
|
9699
9498
|
dataset.providerId,
|
|
9700
9499
|
data.schema
|
|
9701
9500
|
);
|
|
@@ -9734,49 +9533,67 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9734
9533
|
return calculateClusterTextFontSize(radius);
|
|
9735
9534
|
};
|
|
9736
9535
|
}
|
|
9737
|
-
if (radiusField
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
// @ts-ignore
|
|
9742
|
-
radiusScale || sizeScale,
|
|
9536
|
+
if (radiusField) {
|
|
9537
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9538
|
+
radiusField,
|
|
9539
|
+
radiusScale,
|
|
9743
9540
|
visConfig.sizeAggregation,
|
|
9744
9541
|
visConfig.radiusRange || visConfig.sizeRange,
|
|
9745
9542
|
data
|
|
9746
9543
|
);
|
|
9544
|
+
result.getPointRadius = accessor;
|
|
9545
|
+
scales.pointRadius = {
|
|
9546
|
+
field: radiusField,
|
|
9547
|
+
type: radiusScale || "identity",
|
|
9548
|
+
...domainAndRangeFromScale(scale2)
|
|
9549
|
+
};
|
|
9747
9550
|
}
|
|
9748
9551
|
if (strokeColorField) {
|
|
9749
|
-
const
|
|
9750
|
-
const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : fallbackOpacity;
|
|
9552
|
+
const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : 1;
|
|
9751
9553
|
const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
|
|
9752
|
-
|
|
9554
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9753
9555
|
strokeColorField,
|
|
9754
|
-
// @ts-ignore
|
|
9755
9556
|
strokeColorScale,
|
|
9756
|
-
// @ts-ignore
|
|
9757
9557
|
{ aggregation, range },
|
|
9758
9558
|
opacity,
|
|
9759
9559
|
data
|
|
9760
9560
|
);
|
|
9561
|
+
result.getLineColor = accessor;
|
|
9562
|
+
scales.lineColor = {
|
|
9563
|
+
field: strokeColorField,
|
|
9564
|
+
type: strokeColorScale,
|
|
9565
|
+
...domainAndRangeFromScale(scale2)
|
|
9566
|
+
};
|
|
9761
9567
|
}
|
|
9762
9568
|
if (heightField && visConfig.enable3d) {
|
|
9763
|
-
|
|
9569
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9764
9570
|
heightField,
|
|
9765
|
-
// @ts-ignore
|
|
9766
9571
|
heightScale,
|
|
9767
9572
|
visConfig.heightAggregation,
|
|
9768
9573
|
visConfig.heightRange || visConfig.sizeRange,
|
|
9769
9574
|
data
|
|
9770
9575
|
);
|
|
9576
|
+
result.getElevation = accessor;
|
|
9577
|
+
scales.elevation = {
|
|
9578
|
+
field: heightField,
|
|
9579
|
+
type: heightScale || "identity",
|
|
9580
|
+
...domainAndRangeFromScale(scale2)
|
|
9581
|
+
};
|
|
9771
9582
|
}
|
|
9772
9583
|
if (weightField) {
|
|
9773
|
-
|
|
9584
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9774
9585
|
weightField,
|
|
9775
9586
|
void 0,
|
|
9776
9587
|
visConfig.weightAggregation,
|
|
9777
9588
|
void 0,
|
|
9778
9589
|
data
|
|
9779
9590
|
);
|
|
9591
|
+
result.getWeight = accessor;
|
|
9592
|
+
scales.weight = {
|
|
9593
|
+
field: weightField,
|
|
9594
|
+
type: "identity",
|
|
9595
|
+
...domainAndRangeFromScale(scale2)
|
|
9596
|
+
};
|
|
9780
9597
|
}
|
|
9781
9598
|
if (visConfig.customMarkers) {
|
|
9782
9599
|
const maxIconSize = getMaxMarkerSize(visConfig, visualChannels);
|
|
@@ -9814,17 +9631,16 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9814
9631
|
result.getIconSize = getPointRadius;
|
|
9815
9632
|
}
|
|
9816
9633
|
if (visualChannels.rotationField) {
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
data
|
|
9824
|
-
)
|
|
9634
|
+
const { accessor } = getSizeAccessor(
|
|
9635
|
+
visualChannels.rotationField,
|
|
9636
|
+
void 0,
|
|
9637
|
+
null,
|
|
9638
|
+
void 0,
|
|
9639
|
+
data
|
|
9825
9640
|
);
|
|
9641
|
+
result.getIconAngle = negateAccessor(accessor);
|
|
9826
9642
|
}
|
|
9827
|
-
} else if (
|
|
9643
|
+
} else if (layerType === "tileset") {
|
|
9828
9644
|
result.pointType = "circle";
|
|
9829
9645
|
}
|
|
9830
9646
|
if (textLabel && textLabel.length && textLabel[0].field) {
|
|
@@ -9867,7 +9683,7 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9867
9683
|
}
|
|
9868
9684
|
};
|
|
9869
9685
|
}
|
|
9870
|
-
return result;
|
|
9686
|
+
return { channelProps: result, scales };
|
|
9871
9687
|
}
|
|
9872
9688
|
function createLoadOptions(accessToken) {
|
|
9873
9689
|
return {
|
|
@@ -10440,7 +10256,6 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
10440
10256
|
}
|
|
10441
10257
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10442
10258
|
0 && (module.exports = {
|
|
10443
|
-
AGGREGATION,
|
|
10444
10259
|
ApiVersion,
|
|
10445
10260
|
BASEMAP,
|
|
10446
10261
|
CartoAPIError,
|
|
@@ -10490,7 +10305,6 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
10490
10305
|
getApplicableFilters,
|
|
10491
10306
|
getClient,
|
|
10492
10307
|
getColorAccessor,
|
|
10493
|
-
getColorValueAccessor,
|
|
10494
10308
|
getColumnNameFromGeoColumn,
|
|
10495
10309
|
getDataFilterExtensionProps,
|
|
10496
10310
|
getDefaultAggregationExpColumnAliasForLayerType,
|