@carto/api-client 0.5.4 → 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 +114 -304
- 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 +114 -290
- package/build/api-client.js.map +1 -1
- package/package.json +3 -2
- 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/src/models/model.ts +9 -19
package/build/api-client.js
CHANGED
|
@@ -3169,9 +3169,9 @@ function compare(x, y) {
|
|
|
3169
3169
|
for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
|
|
3170
3170
|
return k == l ? 0 : k > l ^ a ? 1 : -1;
|
|
3171
3171
|
}
|
|
3172
|
-
function intCheck(n,
|
|
3173
|
-
if (n <
|
|
3174
|
-
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n <
|
|
3172
|
+
function intCheck(n, min2, max2, name) {
|
|
3173
|
+
if (n < min2 || n > max2 || n !== mathfloor(n)) {
|
|
3174
|
+
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min2 || n > max2 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
3175
3175
|
}
|
|
3176
3176
|
}
|
|
3177
3177
|
function isOdd(n) {
|
|
@@ -6111,6 +6111,7 @@ function executeModel(props) {
|
|
|
6111
6111
|
filters,
|
|
6112
6112
|
filtersLogicalOperator = "and",
|
|
6113
6113
|
spatialDataType = "geo",
|
|
6114
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
6114
6115
|
spatialFiltersMode = "intersects"
|
|
6115
6116
|
} = source;
|
|
6116
6117
|
const queryParams = {
|
|
@@ -6122,18 +6123,13 @@ function executeModel(props) {
|
|
|
6122
6123
|
filters,
|
|
6123
6124
|
filtersLogicalOperator
|
|
6124
6125
|
};
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
queryParams.spatialDataColumn = spatialDataColumn;
|
|
6133
|
-
queryParams.spatialDataType = spatialDataType;
|
|
6134
|
-
}
|
|
6135
|
-
if (spatialDataType !== "geo") {
|
|
6136
|
-
queryParams.spatialFiltersMode = spatialFiltersMode;
|
|
6126
|
+
queryParams.spatialDataType = spatialDataType;
|
|
6127
|
+
queryParams.spatialDataColumn = spatialDataColumn;
|
|
6128
|
+
if (source.spatialFilter) {
|
|
6129
|
+
queryParams.spatialFilters = { [spatialDataColumn]: source.spatialFilter };
|
|
6130
|
+
if (spatialDataType !== "geo") {
|
|
6131
|
+
queryParams.spatialFiltersMode = spatialFiltersMode;
|
|
6132
|
+
}
|
|
6137
6133
|
}
|
|
6138
6134
|
const urlWithSearchParams = url + "?" + objectToURLSearchParams(queryParams).toString();
|
|
6139
6135
|
const isGet = urlWithSearchParams.length <= REQUEST_GET_MAX_URL_LENGTH;
|
|
@@ -6567,11 +6563,11 @@ function min(values, keys, joinOperation) {
|
|
|
6567
6563
|
Infinity
|
|
6568
6564
|
);
|
|
6569
6565
|
}
|
|
6570
|
-
let
|
|
6566
|
+
let min2 = Number.POSITIVE_INFINITY;
|
|
6571
6567
|
for (const value of values) {
|
|
6572
|
-
|
|
6568
|
+
min2 = Math.min(min2, value);
|
|
6573
6569
|
}
|
|
6574
|
-
return
|
|
6570
|
+
return min2;
|
|
6575
6571
|
}
|
|
6576
6572
|
function max(values, keys, joinOperation) {
|
|
6577
6573
|
const normalizedKeys = normalizeKeys(keys);
|
|
@@ -6581,11 +6577,11 @@ function max(values, keys, joinOperation) {
|
|
|
6581
6577
|
-Infinity
|
|
6582
6578
|
);
|
|
6583
6579
|
}
|
|
6584
|
-
let
|
|
6580
|
+
let max2 = Number.NEGATIVE_INFINITY;
|
|
6585
6581
|
for (const value of values) {
|
|
6586
|
-
|
|
6582
|
+
max2 = Math.max(max2, value);
|
|
6587
6583
|
}
|
|
6588
|
-
return
|
|
6584
|
+
return max2;
|
|
6589
6585
|
}
|
|
6590
6586
|
function normalizeKeys(keys) {
|
|
6591
6587
|
return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
|
|
@@ -8112,69 +8108,18 @@ function ascending(a, b) {
|
|
|
8112
8108
|
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
8113
8109
|
}
|
|
8114
8110
|
|
|
8115
|
-
// node_modules/d3-array/src/number.js
|
|
8116
|
-
function* numbers(values, valueof) {
|
|
8117
|
-
if (valueof === void 0) {
|
|
8118
|
-
for (let value of values) {
|
|
8119
|
-
if (value != null && (value = +value) >= value) {
|
|
8120
|
-
yield value;
|
|
8121
|
-
}
|
|
8122
|
-
}
|
|
8123
|
-
} else {
|
|
8124
|
-
let index = -1;
|
|
8125
|
-
for (let value of values) {
|
|
8126
|
-
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
8127
|
-
yield value;
|
|
8128
|
-
}
|
|
8129
|
-
}
|
|
8130
|
-
}
|
|
8131
|
-
}
|
|
8132
|
-
|
|
8133
|
-
// node_modules/d3-array/src/variance.js
|
|
8134
|
-
function variance(values, valueof) {
|
|
8135
|
-
let count = 0;
|
|
8136
|
-
let delta;
|
|
8137
|
-
let mean = 0;
|
|
8138
|
-
let sum3 = 0;
|
|
8139
|
-
if (valueof === void 0) {
|
|
8140
|
-
for (let value of values) {
|
|
8141
|
-
if (value != null && (value = +value) >= value) {
|
|
8142
|
-
delta = value - mean;
|
|
8143
|
-
mean += delta / ++count;
|
|
8144
|
-
sum3 += delta * (value - mean);
|
|
8145
|
-
}
|
|
8146
|
-
}
|
|
8147
|
-
} else {
|
|
8148
|
-
let index = -1;
|
|
8149
|
-
for (let value of values) {
|
|
8150
|
-
if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
|
|
8151
|
-
delta = value - mean;
|
|
8152
|
-
mean += delta / ++count;
|
|
8153
|
-
sum3 += delta * (value - mean);
|
|
8154
|
-
}
|
|
8155
|
-
}
|
|
8156
|
-
}
|
|
8157
|
-
if (count > 1) return sum3 / (count - 1);
|
|
8158
|
-
}
|
|
8159
|
-
|
|
8160
|
-
// node_modules/d3-array/src/deviation.js
|
|
8161
|
-
function deviation(values, valueof) {
|
|
8162
|
-
const v2 = variance(values, valueof);
|
|
8163
|
-
return v2 ? Math.sqrt(v2) : v2;
|
|
8164
|
-
}
|
|
8165
|
-
|
|
8166
8111
|
// node_modules/d3-array/src/extent.js
|
|
8167
8112
|
function extent(values, valueof) {
|
|
8168
|
-
let
|
|
8169
|
-
let
|
|
8113
|
+
let min2;
|
|
8114
|
+
let max2;
|
|
8170
8115
|
if (valueof === void 0) {
|
|
8171
8116
|
for (const value of values) {
|
|
8172
8117
|
if (value != null) {
|
|
8173
|
-
if (
|
|
8174
|
-
if (value >= value)
|
|
8118
|
+
if (min2 === void 0) {
|
|
8119
|
+
if (value >= value) min2 = max2 = value;
|
|
8175
8120
|
} else {
|
|
8176
|
-
if (
|
|
8177
|
-
if (
|
|
8121
|
+
if (min2 > value) min2 = value;
|
|
8122
|
+
if (max2 < value) max2 = value;
|
|
8178
8123
|
}
|
|
8179
8124
|
}
|
|
8180
8125
|
}
|
|
@@ -8182,16 +8127,16 @@ function extent(values, valueof) {
|
|
|
8182
8127
|
let index = -1;
|
|
8183
8128
|
for (let value of values) {
|
|
8184
8129
|
if ((value = valueof(value, ++index, values)) != null) {
|
|
8185
|
-
if (
|
|
8186
|
-
if (value >= value)
|
|
8130
|
+
if (min2 === void 0) {
|
|
8131
|
+
if (value >= value) min2 = max2 = value;
|
|
8187
8132
|
} else {
|
|
8188
|
-
if (
|
|
8189
|
-
if (
|
|
8133
|
+
if (min2 > value) min2 = value;
|
|
8134
|
+
if (max2 < value) max2 = value;
|
|
8190
8135
|
}
|
|
8191
8136
|
}
|
|
8192
8137
|
}
|
|
8193
8138
|
}
|
|
8194
|
-
return [
|
|
8139
|
+
return [min2, max2];
|
|
8195
8140
|
}
|
|
8196
8141
|
|
|
8197
8142
|
// node_modules/internmap/src/index.js
|
|
@@ -8313,102 +8258,6 @@ function groupSort(values, reduce, key) {
|
|
|
8313
8258
|
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);
|
|
8314
8259
|
}
|
|
8315
8260
|
|
|
8316
|
-
// node_modules/d3-array/src/max.js
|
|
8317
|
-
function max2(values, valueof) {
|
|
8318
|
-
let max3;
|
|
8319
|
-
if (valueof === void 0) {
|
|
8320
|
-
for (const value of values) {
|
|
8321
|
-
if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
|
|
8322
|
-
max3 = value;
|
|
8323
|
-
}
|
|
8324
|
-
}
|
|
8325
|
-
} else {
|
|
8326
|
-
let index = -1;
|
|
8327
|
-
for (let value of values) {
|
|
8328
|
-
if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
|
|
8329
|
-
max3 = value;
|
|
8330
|
-
}
|
|
8331
|
-
}
|
|
8332
|
-
}
|
|
8333
|
-
return max3;
|
|
8334
|
-
}
|
|
8335
|
-
|
|
8336
|
-
// node_modules/d3-array/src/min.js
|
|
8337
|
-
function min2(values, valueof) {
|
|
8338
|
-
let min3;
|
|
8339
|
-
if (valueof === void 0) {
|
|
8340
|
-
for (const value of values) {
|
|
8341
|
-
if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
|
|
8342
|
-
min3 = value;
|
|
8343
|
-
}
|
|
8344
|
-
}
|
|
8345
|
-
} else {
|
|
8346
|
-
let index = -1;
|
|
8347
|
-
for (let value of values) {
|
|
8348
|
-
if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
|
|
8349
|
-
min3 = value;
|
|
8350
|
-
}
|
|
8351
|
-
}
|
|
8352
|
-
}
|
|
8353
|
-
return min3;
|
|
8354
|
-
}
|
|
8355
|
-
|
|
8356
|
-
// node_modules/d3-array/src/quickselect.js
|
|
8357
|
-
function quickselect(array, k, left = 0, right = Infinity, compare2) {
|
|
8358
|
-
k = Math.floor(k);
|
|
8359
|
-
left = Math.floor(Math.max(0, left));
|
|
8360
|
-
right = Math.floor(Math.min(array.length - 1, right));
|
|
8361
|
-
if (!(left <= k && k <= right)) return array;
|
|
8362
|
-
compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
|
|
8363
|
-
while (right > left) {
|
|
8364
|
-
if (right - left > 600) {
|
|
8365
|
-
const n = right - left + 1;
|
|
8366
|
-
const m = k - left + 1;
|
|
8367
|
-
const z = Math.log(n);
|
|
8368
|
-
const s = 0.5 * Math.exp(2 * z / 3);
|
|
8369
|
-
const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
8370
|
-
const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
8371
|
-
const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
8372
|
-
quickselect(array, k, newLeft, newRight, compare2);
|
|
8373
|
-
}
|
|
8374
|
-
const t = array[k];
|
|
8375
|
-
let i = left;
|
|
8376
|
-
let j = right;
|
|
8377
|
-
swap(array, left, k);
|
|
8378
|
-
if (compare2(array[right], t) > 0) swap(array, left, right);
|
|
8379
|
-
while (i < j) {
|
|
8380
|
-
swap(array, i, j), ++i, --j;
|
|
8381
|
-
while (compare2(array[i], t) < 0) ++i;
|
|
8382
|
-
while (compare2(array[j], t) > 0) --j;
|
|
8383
|
-
}
|
|
8384
|
-
if (compare2(array[left], t) === 0) swap(array, left, j);
|
|
8385
|
-
else ++j, swap(array, j, right);
|
|
8386
|
-
if (j <= k) left = j + 1;
|
|
8387
|
-
if (k <= j) right = j - 1;
|
|
8388
|
-
}
|
|
8389
|
-
return array;
|
|
8390
|
-
}
|
|
8391
|
-
function swap(array, i, j) {
|
|
8392
|
-
const t = array[i];
|
|
8393
|
-
array[i] = array[j];
|
|
8394
|
-
array[j] = t;
|
|
8395
|
-
}
|
|
8396
|
-
|
|
8397
|
-
// node_modules/d3-array/src/quantile.js
|
|
8398
|
-
function quantile(values, p, valueof) {
|
|
8399
|
-
values = Float64Array.from(numbers(values, valueof));
|
|
8400
|
-
if (!(n = values.length) || isNaN(p = +p)) return;
|
|
8401
|
-
if (p <= 0 || n < 2) return min2(values);
|
|
8402
|
-
if (p >= 1) return max2(values);
|
|
8403
|
-
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));
|
|
8404
|
-
return value0 + (value1 - value0) * (i - i0);
|
|
8405
|
-
}
|
|
8406
|
-
|
|
8407
|
-
// node_modules/d3-array/src/median.js
|
|
8408
|
-
function median(values, valueof) {
|
|
8409
|
-
return quantile(values, 0.5, valueof);
|
|
8410
|
-
}
|
|
8411
|
-
|
|
8412
8261
|
// node_modules/d3-color/src/define.js
|
|
8413
8262
|
function define_default(constructor, factory, prototype) {
|
|
8414
8263
|
constructor.prototype = factory.prototype = prototype;
|
|
@@ -8696,12 +8545,12 @@ function hslConvert(o) {
|
|
|
8696
8545
|
if (!o) return new Hsl();
|
|
8697
8546
|
if (o instanceof Hsl) return o;
|
|
8698
8547
|
o = o.rgb();
|
|
8699
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255,
|
|
8548
|
+
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;
|
|
8700
8549
|
if (s) {
|
|
8701
|
-
if (r ===
|
|
8702
|
-
else if (g ===
|
|
8550
|
+
if (r === max2) h = (g - b) / s + (g < b) * 6;
|
|
8551
|
+
else if (g === max2) h = (b - r) / s + 2;
|
|
8703
8552
|
else h = (r - g) / s + 4;
|
|
8704
|
-
s /= l < 0.5 ?
|
|
8553
|
+
s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
|
|
8705
8554
|
h *= 60;
|
|
8706
8555
|
} else {
|
|
8707
8556
|
s = l > 0 && l < 1 ? 0 : h;
|
|
@@ -8849,25 +8698,11 @@ function identity2(v2) {
|
|
|
8849
8698
|
return v2;
|
|
8850
8699
|
}
|
|
8851
8700
|
var UNKNOWN_COLOR = "#868d91";
|
|
8852
|
-
var AGGREGATION = {
|
|
8853
|
-
average: "MEAN",
|
|
8854
|
-
maximum: "MAX",
|
|
8855
|
-
minimum: "MIN",
|
|
8856
|
-
sum: "SUM"
|
|
8857
|
-
};
|
|
8858
8701
|
var OPACITY_MAP = {
|
|
8859
8702
|
getFillColor: "opacity",
|
|
8860
8703
|
getLineColor: "strokeOpacity",
|
|
8861
8704
|
getTextColor: "opacity"
|
|
8862
8705
|
};
|
|
8863
|
-
var AGGREGATION_FUNC = {
|
|
8864
|
-
"count unique": (values, accessor) => groupSort(values, (v2) => v2.length, accessor).length,
|
|
8865
|
-
median,
|
|
8866
|
-
// Unfortunately mode() is only available in d3-array@3+ which is ESM only
|
|
8867
|
-
mode: (values, accessor) => groupSort(values, (v2) => v2.length, accessor).pop(),
|
|
8868
|
-
stddev: deviation,
|
|
8869
|
-
variance
|
|
8870
|
-
};
|
|
8871
8706
|
var hexToRGBA = (c) => {
|
|
8872
8707
|
const { r, g, b, opacity } = rgb(c);
|
|
8873
8708
|
return [r, g, b, 255 * opacity];
|
|
@@ -8963,11 +8798,11 @@ function domainFromAttribute(attribute, scaleType, scaleLength) {
|
|
|
8963
8798
|
if (scaleType === "quantile" && attribute.quantiles) {
|
|
8964
8799
|
return attribute.quantiles.global ? attribute.quantiles.global[scaleLength] : attribute.quantiles[scaleLength];
|
|
8965
8800
|
}
|
|
8966
|
-
let { min:
|
|
8967
|
-
if (scaleType === "log" &&
|
|
8968
|
-
|
|
8801
|
+
let { min: min2 } = attribute;
|
|
8802
|
+
if (scaleType === "log" && min2 === 0) {
|
|
8803
|
+
min2 = 1e-5;
|
|
8969
8804
|
}
|
|
8970
|
-
return [
|
|
8805
|
+
return [min2, attribute.max];
|
|
8971
8806
|
}
|
|
8972
8807
|
function domainFromValues(values, scaleType) {
|
|
8973
8808
|
if (scaleType === "ordinal" || scaleType === "point") {
|
|
@@ -9025,11 +8860,6 @@ function findAccessorKey(keys, properties) {
|
|
|
9025
8860
|
}
|
|
9026
8861
|
return keys;
|
|
9027
8862
|
}
|
|
9028
|
-
function getColorValueAccessor({ name }, colorAggregation, data) {
|
|
9029
|
-
const aggregator = AGGREGATION_FUNC[colorAggregation];
|
|
9030
|
-
const accessor = (values) => aggregator(values, (p) => p[name]);
|
|
9031
|
-
return normalizeAccessor(accessor, data);
|
|
9032
|
-
}
|
|
9033
8863
|
function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
|
|
9034
8864
|
const scale2 = calculateLayerScale(
|
|
9035
8865
|
colorColumn || name,
|
|
@@ -9047,7 +8877,7 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
|
|
|
9047
8877
|
const { r, g, b } = rgb(scale2(propertyValue));
|
|
9048
8878
|
return [r, g, b, propertyValue === null ? 0 : alpha];
|
|
9049
8879
|
};
|
|
9050
|
-
return normalizeAccessor(accessor, data);
|
|
8880
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9051
8881
|
}
|
|
9052
8882
|
function calculateLayerScale(name, scaleType, range, data) {
|
|
9053
8883
|
const scale2 = SCALE_FUNCS[scaleType]();
|
|
@@ -9134,7 +8964,7 @@ function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
|
|
|
9134
8964
|
const propertyValue = properties[accessorKeys[0]];
|
|
9135
8965
|
return scale2(propertyValue);
|
|
9136
8966
|
};
|
|
9137
|
-
return normalizeAccessor(accessor, data);
|
|
8967
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9138
8968
|
}
|
|
9139
8969
|
var FORMATS = {
|
|
9140
8970
|
date: formatDate,
|
|
@@ -9151,10 +8981,10 @@ function getTextAccessor({ name, type }, data) {
|
|
|
9151
8981
|
return normalizeAccessor(accessor, data);
|
|
9152
8982
|
}
|
|
9153
8983
|
function calculateClusterRadius(properties, stats, radiusRange, column) {
|
|
9154
|
-
const { min:
|
|
8984
|
+
const { min: min2, max: max2 } = stats[column];
|
|
9155
8985
|
const value = properties[column];
|
|
9156
|
-
if (
|
|
9157
|
-
const normalizedValue = (value -
|
|
8986
|
+
if (min2 === max2) return radiusRange[1];
|
|
8987
|
+
const normalizedValue = (value - min2) / (max2 - min2);
|
|
9158
8988
|
return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
|
|
9159
8989
|
}
|
|
9160
8990
|
function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, schema) {
|
|
@@ -9215,6 +9045,14 @@ function parseMap(json) {
|
|
|
9215
9045
|
assert2(data, `No data loaded for dataId: ${dataId}`);
|
|
9216
9046
|
const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config3, dataset);
|
|
9217
9047
|
const styleProps = createStyleProps(config3, propMap);
|
|
9048
|
+
const { channelProps, scales } = createChannelProps(
|
|
9049
|
+
id,
|
|
9050
|
+
type,
|
|
9051
|
+
config3,
|
|
9052
|
+
visualChannels,
|
|
9053
|
+
data,
|
|
9054
|
+
dataset
|
|
9055
|
+
);
|
|
9218
9056
|
const layer = {
|
|
9219
9057
|
type,
|
|
9220
9058
|
filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[dataId],
|
|
@@ -9224,22 +9062,15 @@ function parseMap(json) {
|
|
|
9224
9062
|
...defaultProps2,
|
|
9225
9063
|
...createInteractionProps(interactionConfig),
|
|
9226
9064
|
...styleProps,
|
|
9227
|
-
...
|
|
9228
|
-
id,
|
|
9229
|
-
type,
|
|
9230
|
-
config3,
|
|
9231
|
-
visualChannels,
|
|
9232
|
-
data,
|
|
9233
|
-
dataset
|
|
9234
|
-
),
|
|
9235
|
-
// Must come after style
|
|
9065
|
+
...channelProps,
|
|
9236
9066
|
...createParametersProp(
|
|
9237
9067
|
layerBlending,
|
|
9238
9068
|
styleProps.parameters || {}
|
|
9239
9069
|
),
|
|
9240
9070
|
// Must come after style
|
|
9241
9071
|
...createLoadOptions(token)
|
|
9242
|
-
}
|
|
9072
|
+
},
|
|
9073
|
+
scales
|
|
9243
9074
|
};
|
|
9244
9075
|
return layer;
|
|
9245
9076
|
} catch (e) {
|
|
@@ -9306,69 +9137,47 @@ function createStyleProps(config2, mapping) {
|
|
|
9306
9137
|
result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
|
|
9307
9138
|
return result;
|
|
9308
9139
|
}
|
|
9309
|
-
function
|
|
9140
|
+
function domainAndRangeFromScale(scale2) {
|
|
9141
|
+
return {
|
|
9142
|
+
domain: scale2.domain(),
|
|
9143
|
+
range: scale2.range()
|
|
9144
|
+
};
|
|
9145
|
+
}
|
|
9146
|
+
function createChannelProps(id, layerType, config2, visualChannels, data, dataset) {
|
|
9310
9147
|
const {
|
|
9311
9148
|
colorField,
|
|
9312
9149
|
colorScale,
|
|
9313
9150
|
radiusField,
|
|
9314
9151
|
radiusScale,
|
|
9315
|
-
sizeField,
|
|
9316
|
-
sizeScale,
|
|
9317
9152
|
strokeColorField,
|
|
9318
9153
|
strokeColorScale,
|
|
9319
9154
|
weightField
|
|
9320
9155
|
} = visualChannels;
|
|
9321
|
-
|
|
9322
|
-
if (type === "hexagonId") {
|
|
9323
|
-
heightField = sizeField;
|
|
9324
|
-
heightScale = sizeScale;
|
|
9325
|
-
}
|
|
9156
|
+
const { heightField, heightScale } = visualChannels;
|
|
9326
9157
|
const { textLabel, visConfig } = config2;
|
|
9327
9158
|
const result = {};
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
if (colorField) {
|
|
9331
|
-
const { colorAggregation } = config2.visConfig;
|
|
9332
|
-
if (!AGGREGATION[colorAggregation]) {
|
|
9333
|
-
result.getColorValue = getColorValueAccessor(
|
|
9334
|
-
colorField,
|
|
9335
|
-
colorAggregation,
|
|
9336
|
-
data
|
|
9337
|
-
);
|
|
9338
|
-
} else {
|
|
9339
|
-
result.getColorWeight = (d) => d[colorField.name];
|
|
9340
|
-
}
|
|
9341
|
-
}
|
|
9342
|
-
} else if (colorField) {
|
|
9159
|
+
const scales = {};
|
|
9160
|
+
if (colorField) {
|
|
9343
9161
|
const { colorAggregation: aggregation, colorRange: range } = visConfig;
|
|
9344
|
-
|
|
9162
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9345
9163
|
colorField,
|
|
9346
|
-
// @ts-ignore
|
|
9347
9164
|
colorScale,
|
|
9348
9165
|
{ aggregation, range },
|
|
9349
9166
|
visConfig.opacity,
|
|
9350
9167
|
data
|
|
9351
9168
|
);
|
|
9169
|
+
result.getFillColor = accessor;
|
|
9170
|
+
scales.fillColor = {
|
|
9171
|
+
field: colorField,
|
|
9172
|
+
type: colorScale,
|
|
9173
|
+
...domainAndRangeFromScale(scale2)
|
|
9174
|
+
};
|
|
9175
|
+
} else if (visConfig.filled) {
|
|
9176
|
+
scales.fillColor = {};
|
|
9352
9177
|
}
|
|
9353
|
-
if (
|
|
9354
|
-
const altitude = config2.columns?.altitude;
|
|
9355
|
-
if (altitude) {
|
|
9356
|
-
result.dataTransform = (data2) => {
|
|
9357
|
-
data2.features.forEach(
|
|
9358
|
-
({ geometry, properties }) => {
|
|
9359
|
-
const { type: type2, coordinates } = geometry;
|
|
9360
|
-
if (type2 === "Point") {
|
|
9361
|
-
coordinates[2] = properties[altitude];
|
|
9362
|
-
}
|
|
9363
|
-
}
|
|
9364
|
-
);
|
|
9365
|
-
return data2;
|
|
9366
|
-
};
|
|
9367
|
-
}
|
|
9368
|
-
}
|
|
9369
|
-
if (type === "clusterTile") {
|
|
9178
|
+
if (layerType === "clusterTile") {
|
|
9370
9179
|
const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
|
|
9371
|
-
|
|
9180
|
+
layerType,
|
|
9372
9181
|
dataset.providerId,
|
|
9373
9182
|
data.schema
|
|
9374
9183
|
);
|
|
@@ -9407,49 +9216,67 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9407
9216
|
return calculateClusterTextFontSize(radius);
|
|
9408
9217
|
};
|
|
9409
9218
|
}
|
|
9410
|
-
if (radiusField
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
// @ts-ignore
|
|
9415
|
-
radiusScale || sizeScale,
|
|
9219
|
+
if (radiusField) {
|
|
9220
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9221
|
+
radiusField,
|
|
9222
|
+
radiusScale,
|
|
9416
9223
|
visConfig.sizeAggregation,
|
|
9417
9224
|
visConfig.radiusRange || visConfig.sizeRange,
|
|
9418
9225
|
data
|
|
9419
9226
|
);
|
|
9227
|
+
result.getPointRadius = accessor;
|
|
9228
|
+
scales.pointRadius = {
|
|
9229
|
+
field: radiusField,
|
|
9230
|
+
type: radiusScale || "identity",
|
|
9231
|
+
...domainAndRangeFromScale(scale2)
|
|
9232
|
+
};
|
|
9420
9233
|
}
|
|
9421
9234
|
if (strokeColorField) {
|
|
9422
|
-
const
|
|
9423
|
-
const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : fallbackOpacity;
|
|
9235
|
+
const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : 1;
|
|
9424
9236
|
const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
|
|
9425
|
-
|
|
9237
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9426
9238
|
strokeColorField,
|
|
9427
|
-
// @ts-ignore
|
|
9428
9239
|
strokeColorScale,
|
|
9429
|
-
// @ts-ignore
|
|
9430
9240
|
{ aggregation, range },
|
|
9431
9241
|
opacity,
|
|
9432
9242
|
data
|
|
9433
9243
|
);
|
|
9244
|
+
result.getLineColor = accessor;
|
|
9245
|
+
scales.lineColor = {
|
|
9246
|
+
field: strokeColorField,
|
|
9247
|
+
type: strokeColorScale,
|
|
9248
|
+
...domainAndRangeFromScale(scale2)
|
|
9249
|
+
};
|
|
9434
9250
|
}
|
|
9435
9251
|
if (heightField && visConfig.enable3d) {
|
|
9436
|
-
|
|
9252
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9437
9253
|
heightField,
|
|
9438
|
-
// @ts-ignore
|
|
9439
9254
|
heightScale,
|
|
9440
9255
|
visConfig.heightAggregation,
|
|
9441
9256
|
visConfig.heightRange || visConfig.sizeRange,
|
|
9442
9257
|
data
|
|
9443
9258
|
);
|
|
9259
|
+
result.getElevation = accessor;
|
|
9260
|
+
scales.elevation = {
|
|
9261
|
+
field: heightField,
|
|
9262
|
+
type: heightScale || "identity",
|
|
9263
|
+
...domainAndRangeFromScale(scale2)
|
|
9264
|
+
};
|
|
9444
9265
|
}
|
|
9445
9266
|
if (weightField) {
|
|
9446
|
-
|
|
9267
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9447
9268
|
weightField,
|
|
9448
9269
|
void 0,
|
|
9449
9270
|
visConfig.weightAggregation,
|
|
9450
9271
|
void 0,
|
|
9451
9272
|
data
|
|
9452
9273
|
);
|
|
9274
|
+
result.getWeight = accessor;
|
|
9275
|
+
scales.weight = {
|
|
9276
|
+
field: weightField,
|
|
9277
|
+
type: "identity",
|
|
9278
|
+
...domainAndRangeFromScale(scale2)
|
|
9279
|
+
};
|
|
9453
9280
|
}
|
|
9454
9281
|
if (visConfig.customMarkers) {
|
|
9455
9282
|
const maxIconSize = getMaxMarkerSize(visConfig, visualChannels);
|
|
@@ -9487,17 +9314,16 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9487
9314
|
result.getIconSize = getPointRadius;
|
|
9488
9315
|
}
|
|
9489
9316
|
if (visualChannels.rotationField) {
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
data
|
|
9497
|
-
)
|
|
9317
|
+
const { accessor } = getSizeAccessor(
|
|
9318
|
+
visualChannels.rotationField,
|
|
9319
|
+
void 0,
|
|
9320
|
+
null,
|
|
9321
|
+
void 0,
|
|
9322
|
+
data
|
|
9498
9323
|
);
|
|
9324
|
+
result.getIconAngle = negateAccessor(accessor);
|
|
9499
9325
|
}
|
|
9500
|
-
} else if (
|
|
9326
|
+
} else if (layerType === "tileset") {
|
|
9501
9327
|
result.pointType = "circle";
|
|
9502
9328
|
}
|
|
9503
9329
|
if (textLabel && textLabel.length && textLabel[0].field) {
|
|
@@ -9540,7 +9366,7 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
9540
9366
|
}
|
|
9541
9367
|
};
|
|
9542
9368
|
}
|
|
9543
|
-
return result;
|
|
9369
|
+
return { channelProps: result, scales };
|
|
9544
9370
|
}
|
|
9545
9371
|
function createLoadOptions(accessToken) {
|
|
9546
9372
|
return {
|
|
@@ -10105,7 +9931,6 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
10105
9931
|
);
|
|
10106
9932
|
}
|
|
10107
9933
|
export {
|
|
10108
|
-
AGGREGATION,
|
|
10109
9934
|
ApiVersion,
|
|
10110
9935
|
basemap_styles_default as BASEMAP,
|
|
10111
9936
|
CartoAPIError,
|
|
@@ -10155,7 +9980,6 @@ export {
|
|
|
10155
9980
|
getApplicableFilters,
|
|
10156
9981
|
getClient,
|
|
10157
9982
|
getColorAccessor,
|
|
10158
|
-
getColorValueAccessor,
|
|
10159
9983
|
getColumnNameFromGeoColumn,
|
|
10160
9984
|
getDataFilterExtensionProps,
|
|
10161
9985
|
getDefaultAggregationExpColumnAliasForLayerType,
|