@carto/api-client 0.5.15-alpha.raster-4 → 0.5.15
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 -0
- package/build/api-client.cjs +252 -974
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +55 -153
- package/build/api-client.d.ts +55 -153
- package/build/api-client.js +246 -960
- package/build/api-client.js.map +1 -1
- package/package.json +4 -6
- package/src/fetch-map/basemap-styles.ts +1 -1
- package/src/fetch-map/index.ts +1 -6
- package/src/fetch-map/layer-map.ts +37 -126
- package/src/fetch-map/parse-map.ts +165 -284
- package/src/fetch-map/types.ts +7 -21
- package/src/fetch-map/utils.ts +0 -56
- package/src/index.ts +1 -7
- package/src/sources/index.ts +12 -0
- package/src/sources/trajectory-query-source.ts +101 -0
- package/src/sources/trajectory-table-source.ts +96 -0
- package/src/sources/types.ts +12 -53
- package/src/widget-sources/types.ts +4 -1
- package/src/fetch-map/raster-layer.ts +0 -536
- package/src/fetch-map/vec-expr-evaluator.ts +0 -374
package/build/api-client.cjs
CHANGED
|
@@ -125,16 +125,9 @@ __export(src_exports, {
|
|
|
125
125
|
WidgetSource: () => WidgetSource,
|
|
126
126
|
WidgetTableSource: () => WidgetTableSource,
|
|
127
127
|
WidgetTilesetSource: () => WidgetTilesetSource,
|
|
128
|
-
_ErrorCode: () => ErrorCode,
|
|
129
|
-
_applyLayerGroupFilters: () => applyLayerGroupFilters,
|
|
130
128
|
_buildFeatureFilter: () => _buildFeatureFilter,
|
|
131
|
-
_createVecExprEvaluator: () => createVecExprEvaluator,
|
|
132
129
|
_domainFromValues: () => domainFromValues,
|
|
133
|
-
_evaluateVecExpr: () => evaluateVecExpr,
|
|
134
130
|
_getHexagonResolution: () => _getHexagonResolution,
|
|
135
|
-
_getLog10ScaleSteps: () => getLog10ScaleSteps,
|
|
136
|
-
_getRasterTileLayerStyleProps: () => getRasterTileLayerStyleProps,
|
|
137
|
-
_validateVecExprSyntax: () => validateVecExprSyntax,
|
|
138
131
|
addFilter: () => addFilter,
|
|
139
132
|
aggregate: () => aggregate,
|
|
140
133
|
aggregationFunctions: () => aggregationFunctions,
|
|
@@ -147,11 +140,9 @@ __export(src_exports, {
|
|
|
147
140
|
buildStatsUrl: () => buildStatsUrl,
|
|
148
141
|
calculateClusterRadius: () => calculateClusterRadius,
|
|
149
142
|
calculateClusterTextFontSize: () => calculateClusterTextFontSize,
|
|
150
|
-
calculateLayerScale: () => calculateLayerScale,
|
|
151
143
|
clearDefaultRequestCache: () => clearDefaultRequestCache,
|
|
152
144
|
clearFilters: () => clearFilters,
|
|
153
145
|
configureSource: () => configureSource,
|
|
154
|
-
createColorScale: () => createColorScale,
|
|
155
146
|
createPolygonSpatialFilter: () => createPolygonSpatialFilter,
|
|
156
147
|
createViewportSpatialFilter: () => createViewportSpatialFilter,
|
|
157
148
|
fetchBasemapProps: () => fetchBasemapProps,
|
|
@@ -166,7 +157,6 @@ __export(src_exports, {
|
|
|
166
157
|
getDefaultAggregationExpColumnAliasForLayerType: () => getDefaultAggregationExpColumnAliasForLayerType,
|
|
167
158
|
getFilter: () => getFilter,
|
|
168
159
|
getIconUrlAccessor: () => getIconUrlAccessor,
|
|
169
|
-
getLayerDescriptor: () => getLayerDescriptor,
|
|
170
160
|
getLayerProps: () => getLayerProps,
|
|
171
161
|
getMaxMarkerSize: () => getMaxMarkerSize,
|
|
172
162
|
getSizeAccessor: () => getSizeAccessor,
|
|
@@ -197,6 +187,8 @@ __export(src_exports, {
|
|
|
197
187
|
tileFeatures: () => tileFeatures,
|
|
198
188
|
tileFeaturesGeometries: () => tileFeaturesGeometries,
|
|
199
189
|
tileFeaturesSpatialIndex: () => tileFeaturesSpatialIndex,
|
|
190
|
+
trajectoryQuerySource: () => trajectoryQuerySource,
|
|
191
|
+
trajectoryTableSource: () => trajectoryTableSource,
|
|
200
192
|
transformToTileCoords: () => transformToTileCoords,
|
|
201
193
|
vectorQuerySource: () => vectorQuerySource,
|
|
202
194
|
vectorTableSource: () => vectorTableSource,
|
|
@@ -8491,6 +8483,104 @@ var vectorTilesetSource = async function(options) {
|
|
|
8491
8483
|
);
|
|
8492
8484
|
};
|
|
8493
8485
|
|
|
8486
|
+
// src/sources/trajectory-query-source.ts
|
|
8487
|
+
init_cjs_shims();
|
|
8488
|
+
var trajectoryQuerySource = async function(options) {
|
|
8489
|
+
const {
|
|
8490
|
+
columns,
|
|
8491
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8492
|
+
sqlQuery,
|
|
8493
|
+
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8494
|
+
queryParameters,
|
|
8495
|
+
aggregationExp,
|
|
8496
|
+
trajectoryIdColumn,
|
|
8497
|
+
timestampColumn
|
|
8498
|
+
} = options;
|
|
8499
|
+
const spatialDataType = "trajectory";
|
|
8500
|
+
const urlParameters = {
|
|
8501
|
+
spatialDataColumn,
|
|
8502
|
+
spatialDataType,
|
|
8503
|
+
tileResolution: tileResolution.toString(),
|
|
8504
|
+
q: sqlQuery,
|
|
8505
|
+
trajectoryIdColumn,
|
|
8506
|
+
timestampColumn
|
|
8507
|
+
};
|
|
8508
|
+
if (columns) {
|
|
8509
|
+
urlParameters.columns = columns.join(",");
|
|
8510
|
+
}
|
|
8511
|
+
if (queryParameters) {
|
|
8512
|
+
urlParameters.queryParameters = queryParameters;
|
|
8513
|
+
}
|
|
8514
|
+
if (aggregationExp) {
|
|
8515
|
+
urlParameters.aggregationExp = aggregationExp;
|
|
8516
|
+
}
|
|
8517
|
+
const result = await baseSource(
|
|
8518
|
+
"query",
|
|
8519
|
+
options,
|
|
8520
|
+
urlParameters
|
|
8521
|
+
);
|
|
8522
|
+
const widgetSource = new WidgetQuerySource({
|
|
8523
|
+
...options,
|
|
8524
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8525
|
+
spatialDataColumn,
|
|
8526
|
+
spatialDataType,
|
|
8527
|
+
tileResolution
|
|
8528
|
+
});
|
|
8529
|
+
const timestampRange = await widgetSource.getRange({ column: timestampColumn });
|
|
8530
|
+
return {
|
|
8531
|
+
...result,
|
|
8532
|
+
widgetSource,
|
|
8533
|
+
timestampRange
|
|
8534
|
+
};
|
|
8535
|
+
};
|
|
8536
|
+
|
|
8537
|
+
// src/sources/trajectory-table-source.ts
|
|
8538
|
+
init_cjs_shims();
|
|
8539
|
+
var trajectoryTableSource = async function(options) {
|
|
8540
|
+
const {
|
|
8541
|
+
columns,
|
|
8542
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8543
|
+
tableName,
|
|
8544
|
+
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8545
|
+
aggregationExp,
|
|
8546
|
+
trajectoryIdColumn,
|
|
8547
|
+
timestampColumn
|
|
8548
|
+
} = options;
|
|
8549
|
+
const spatialDataType = "trajectory";
|
|
8550
|
+
const urlParameters = {
|
|
8551
|
+
name: tableName,
|
|
8552
|
+
spatialDataColumn,
|
|
8553
|
+
spatialDataType,
|
|
8554
|
+
tileResolution: tileResolution.toString(),
|
|
8555
|
+
trajectoryIdColumn,
|
|
8556
|
+
timestampColumn
|
|
8557
|
+
};
|
|
8558
|
+
if (columns) {
|
|
8559
|
+
urlParameters.columns = columns.join(",");
|
|
8560
|
+
}
|
|
8561
|
+
if (aggregationExp) {
|
|
8562
|
+
urlParameters.aggregationExp = aggregationExp;
|
|
8563
|
+
}
|
|
8564
|
+
const result = await baseSource(
|
|
8565
|
+
"table",
|
|
8566
|
+
options,
|
|
8567
|
+
urlParameters
|
|
8568
|
+
);
|
|
8569
|
+
const widgetSource = new WidgetTableSource({
|
|
8570
|
+
...options,
|
|
8571
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8572
|
+
spatialDataColumn,
|
|
8573
|
+
spatialDataType,
|
|
8574
|
+
tileResolution
|
|
8575
|
+
});
|
|
8576
|
+
const timestampRange = await widgetSource.getRange({ column: timestampColumn });
|
|
8577
|
+
return {
|
|
8578
|
+
...result,
|
|
8579
|
+
widgetSource,
|
|
8580
|
+
timestampRange
|
|
8581
|
+
};
|
|
8582
|
+
};
|
|
8583
|
+
|
|
8494
8584
|
// src/api/query.ts
|
|
8495
8585
|
var query = async function(options) {
|
|
8496
8586
|
const {
|
|
@@ -8649,253 +8739,11 @@ var basemap_styles_default = {
|
|
|
8649
8739
|
DARK_MATTER_NOLABELS: getStyleUrl("dark-matter-nolabels")
|
|
8650
8740
|
};
|
|
8651
8741
|
|
|
8652
|
-
// src/fetch-map/
|
|
8742
|
+
// src/fetch-map/fetch-map.ts
|
|
8653
8743
|
init_cjs_shims();
|
|
8654
8744
|
|
|
8655
|
-
// src/fetch-map/
|
|
8745
|
+
// src/fetch-map/parse-map.ts
|
|
8656
8746
|
init_cjs_shims();
|
|
8657
|
-
var import_jsep = __toESM(require("jsep"), 1);
|
|
8658
|
-
function createVecExprEvaluator(expression) {
|
|
8659
|
-
try {
|
|
8660
|
-
const parsed = compile(expression);
|
|
8661
|
-
const evalFun = (context) => evaluate(parsed, context);
|
|
8662
|
-
evalFun.symbols = getSymbols(parsed);
|
|
8663
|
-
return evalFun;
|
|
8664
|
-
} catch {
|
|
8665
|
-
return null;
|
|
8666
|
-
}
|
|
8667
|
-
}
|
|
8668
|
-
function evaluateVecExpr(expression, context) {
|
|
8669
|
-
try {
|
|
8670
|
-
return createVecExprEvaluator(expression)?.(context);
|
|
8671
|
-
} catch {
|
|
8672
|
-
return null;
|
|
8673
|
-
}
|
|
8674
|
-
}
|
|
8675
|
-
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
8676
|
-
ErrorCode2[ErrorCode2["InvalidSyntax"] = 0] = "InvalidSyntax";
|
|
8677
|
-
ErrorCode2[ErrorCode2["UnknownIdentifier"] = 1] = "UnknownIdentifier";
|
|
8678
|
-
return ErrorCode2;
|
|
8679
|
-
})(ErrorCode || {});
|
|
8680
|
-
function validateVecExprSyntax(expression, context) {
|
|
8681
|
-
let parsed;
|
|
8682
|
-
try {
|
|
8683
|
-
parsed = compile(expression);
|
|
8684
|
-
} catch (e) {
|
|
8685
|
-
return {
|
|
8686
|
-
valid: false,
|
|
8687
|
-
errorCode: 0 /* InvalidSyntax */,
|
|
8688
|
-
errorMessage: e && "message" in e ? String(e.message) : String(e)
|
|
8689
|
-
};
|
|
8690
|
-
}
|
|
8691
|
-
return validate(parsed, context);
|
|
8692
|
-
}
|
|
8693
|
-
function createResultArray(typeTemplate, length2 = typeTemplate.length) {
|
|
8694
|
-
return new Array(length2);
|
|
8695
|
-
}
|
|
8696
|
-
function isVecLike(a) {
|
|
8697
|
-
return Array.isArray(a) || ArrayBuffer.isView(a);
|
|
8698
|
-
}
|
|
8699
|
-
var createBinopVec = (scalarBinOp) => (left, right) => {
|
|
8700
|
-
const length2 = Math.min(left.length, right.length);
|
|
8701
|
-
const r = createResultArray(left, length2);
|
|
8702
|
-
for (let i = 0; i < length2; i++) {
|
|
8703
|
-
r[i] = scalarBinOp(left[i], right[i]);
|
|
8704
|
-
}
|
|
8705
|
-
return r;
|
|
8706
|
-
};
|
|
8707
|
-
var createBinopVecNum = (scalarBinOp) => (left, right) => {
|
|
8708
|
-
const length2 = left.length;
|
|
8709
|
-
const r = createResultArray(left, length2);
|
|
8710
|
-
for (let i = 0; i < length2; i++) {
|
|
8711
|
-
r[i] = scalarBinOp(left[i], right);
|
|
8712
|
-
}
|
|
8713
|
-
return r;
|
|
8714
|
-
};
|
|
8715
|
-
var createBinopNumVec = (scalarBinOp) => (left, right) => {
|
|
8716
|
-
const length2 = right.length;
|
|
8717
|
-
const r = createResultArray(right, length2);
|
|
8718
|
-
for (let i = 0; i < length2; i++) {
|
|
8719
|
-
r[i] = scalarBinOp(left, right[i]);
|
|
8720
|
-
}
|
|
8721
|
-
return r;
|
|
8722
|
-
};
|
|
8723
|
-
var createUnopVec = (scalarUnop) => (a) => {
|
|
8724
|
-
const length2 = a.length;
|
|
8725
|
-
const r = createResultArray(a, length2);
|
|
8726
|
-
for (let i = 0; i < length2; i++) {
|
|
8727
|
-
r[i] = scalarUnop(a[i]);
|
|
8728
|
-
}
|
|
8729
|
-
return r;
|
|
8730
|
-
};
|
|
8731
|
-
function mapDictValues(dict, fun) {
|
|
8732
|
-
return Object.keys(dict).reduce(
|
|
8733
|
-
(acc, key) => {
|
|
8734
|
-
acc[key] = fun(dict[key]);
|
|
8735
|
-
return acc;
|
|
8736
|
-
},
|
|
8737
|
-
{}
|
|
8738
|
-
);
|
|
8739
|
-
}
|
|
8740
|
-
var binopsNum = {
|
|
8741
|
-
"||": (a, b) => a || b,
|
|
8742
|
-
"&&": (a, b) => a && b,
|
|
8743
|
-
"|": (a, b) => a | b,
|
|
8744
|
-
"^": (a, b) => a ^ b,
|
|
8745
|
-
"&": (a, b) => a & b,
|
|
8746
|
-
"==": (a, b) => Number(a == b),
|
|
8747
|
-
"!=": (a, b) => Number(a != b),
|
|
8748
|
-
"===": (a, b) => Number(a === b),
|
|
8749
|
-
"!==": (a, b) => Number(a !== b),
|
|
8750
|
-
"<": (a, b) => Number(a < b),
|
|
8751
|
-
">": (a, b) => Number(a > b),
|
|
8752
|
-
"<=": (a, b) => Number(a <= b),
|
|
8753
|
-
">=": (a, b) => Number(a >= b),
|
|
8754
|
-
"<<": (a, b) => a << b,
|
|
8755
|
-
">>": (a, b) => a >> b,
|
|
8756
|
-
">>>": (a, b) => a >>> b,
|
|
8757
|
-
"+": (a, b) => a + b,
|
|
8758
|
-
"-": (a, b) => a - b,
|
|
8759
|
-
"*": (a, b) => a * b,
|
|
8760
|
-
"/": (a, b) => a / b,
|
|
8761
|
-
"%": (a, b) => a % b
|
|
8762
|
-
};
|
|
8763
|
-
var unopsNum = {
|
|
8764
|
-
"-": (a) => -a,
|
|
8765
|
-
"+": (a) => +a,
|
|
8766
|
-
"~": (a) => ~a,
|
|
8767
|
-
"!": (a) => Number(!a)
|
|
8768
|
-
};
|
|
8769
|
-
var binopsVector = mapDictValues(binopsNum, createBinopVec);
|
|
8770
|
-
var binopsNumVec = mapDictValues(binopsNum, createBinopNumVec);
|
|
8771
|
-
var binopsVecNum = mapDictValues(binopsNum, createBinopVecNum);
|
|
8772
|
-
var unopsVector = mapDictValues(unopsNum, createUnopVec);
|
|
8773
|
-
function getBinop(operator, left, right) {
|
|
8774
|
-
const isLeftVec = isVecLike(left);
|
|
8775
|
-
const isRightVec = isVecLike(right);
|
|
8776
|
-
if (isLeftVec && isRightVec) {
|
|
8777
|
-
return binopsVector[operator];
|
|
8778
|
-
} else if (isLeftVec) {
|
|
8779
|
-
return binopsVecNum[operator];
|
|
8780
|
-
} else if (isRightVec) {
|
|
8781
|
-
return binopsNumVec[operator];
|
|
8782
|
-
} else {
|
|
8783
|
-
return binopsNum[operator];
|
|
8784
|
-
}
|
|
8785
|
-
}
|
|
8786
|
-
function evaluate(_node, context) {
|
|
8787
|
-
const node = _node;
|
|
8788
|
-
switch (node.type) {
|
|
8789
|
-
case "BinaryExpression": {
|
|
8790
|
-
const left = evaluate(node.left, context);
|
|
8791
|
-
const right = evaluate(node.right, context);
|
|
8792
|
-
const binopFun = getBinop(node.operator, left, right);
|
|
8793
|
-
return binopFun(left, right);
|
|
8794
|
-
}
|
|
8795
|
-
case "ConditionalExpression": {
|
|
8796
|
-
const val = evaluate(node.test, context);
|
|
8797
|
-
if (isVecLike(val)) {
|
|
8798
|
-
const length2 = val.length;
|
|
8799
|
-
const consequentVal = evaluate(node.consequent, context);
|
|
8800
|
-
const alternateVal = evaluate(node.alternate, context);
|
|
8801
|
-
const r = createResultArray(val);
|
|
8802
|
-
for (let i = 0; i < length2; i++) {
|
|
8803
|
-
const entryVal = val[i] ? consequentVal : alternateVal;
|
|
8804
|
-
r[i] = isVecLike(entryVal) ? entryVal[i] ?? NaN : entryVal;
|
|
8805
|
-
}
|
|
8806
|
-
return r;
|
|
8807
|
-
} else {
|
|
8808
|
-
return val ? evaluate(node.consequent, context) : evaluate(node.alternate, context);
|
|
8809
|
-
}
|
|
8810
|
-
}
|
|
8811
|
-
case "Identifier":
|
|
8812
|
-
return context[node.name];
|
|
8813
|
-
case "Literal":
|
|
8814
|
-
return node.value;
|
|
8815
|
-
case "UnaryExpression": {
|
|
8816
|
-
const val = evaluate(node.argument, context);
|
|
8817
|
-
const unopFun = isVecLike(val) ? unopsVector[node.operator] : unopsNum[node.operator];
|
|
8818
|
-
return unopFun(val);
|
|
8819
|
-
}
|
|
8820
|
-
default:
|
|
8821
|
-
return void 0;
|
|
8822
|
-
}
|
|
8823
|
-
}
|
|
8824
|
-
var validResult = { valid: true };
|
|
8825
|
-
function visit(_node, visitor) {
|
|
8826
|
-
const node = _node;
|
|
8827
|
-
visitor(node);
|
|
8828
|
-
switch (node.type) {
|
|
8829
|
-
case "BinaryExpression": {
|
|
8830
|
-
visit(node.left, visitor);
|
|
8831
|
-
visit(node.right, visitor);
|
|
8832
|
-
break;
|
|
8833
|
-
}
|
|
8834
|
-
case "ConditionalExpression": {
|
|
8835
|
-
visit(node.test, visitor);
|
|
8836
|
-
visit(node.consequent, visitor);
|
|
8837
|
-
visit(node.alternate, visitor);
|
|
8838
|
-
break;
|
|
8839
|
-
}
|
|
8840
|
-
case "UnaryExpression": {
|
|
8841
|
-
visit(node.argument, visitor);
|
|
8842
|
-
break;
|
|
8843
|
-
}
|
|
8844
|
-
}
|
|
8845
|
-
}
|
|
8846
|
-
var supportedExpressionTypes = [
|
|
8847
|
-
"BinaryExpression",
|
|
8848
|
-
"UnaryExpression",
|
|
8849
|
-
"ConditionalExpression",
|
|
8850
|
-
"LogicalExpression",
|
|
8851
|
-
"Identifier",
|
|
8852
|
-
"Literal"
|
|
8853
|
-
];
|
|
8854
|
-
function validate(_node, context) {
|
|
8855
|
-
const node = _node;
|
|
8856
|
-
const errors = [];
|
|
8857
|
-
visit(node, (node2) => {
|
|
8858
|
-
if (!supportedExpressionTypes.includes(node2.type)) {
|
|
8859
|
-
errors.push({
|
|
8860
|
-
valid: false,
|
|
8861
|
-
errorCode: 0 /* InvalidSyntax */,
|
|
8862
|
-
errorMessage: `Not allowed`
|
|
8863
|
-
});
|
|
8864
|
-
return;
|
|
8865
|
-
}
|
|
8866
|
-
if (node2.type === "Identifier") {
|
|
8867
|
-
if (!Object.prototype.hasOwnProperty.call(context, node2.name)) {
|
|
8868
|
-
return errors.push({
|
|
8869
|
-
valid: false,
|
|
8870
|
-
errorCode: 1 /* UnknownIdentifier */,
|
|
8871
|
-
errorMessage: `"${node2.name}" not found`
|
|
8872
|
-
});
|
|
8873
|
-
}
|
|
8874
|
-
}
|
|
8875
|
-
if (node2.type === "Literal") {
|
|
8876
|
-
if (typeof node2.value !== "number") {
|
|
8877
|
-
return errors.push({
|
|
8878
|
-
valid: false,
|
|
8879
|
-
errorCode: 0 /* InvalidSyntax */,
|
|
8880
|
-
errorMessage: `Only number literals are supported`
|
|
8881
|
-
});
|
|
8882
|
-
}
|
|
8883
|
-
}
|
|
8884
|
-
});
|
|
8885
|
-
return errors.length ? errors[0] : validResult;
|
|
8886
|
-
}
|
|
8887
|
-
function getSymbols(node) {
|
|
8888
|
-
const symbols = /* @__PURE__ */ new Set();
|
|
8889
|
-
visit(node, (node2) => {
|
|
8890
|
-
if (node2.type === "Identifier") {
|
|
8891
|
-
symbols.add(node2.name);
|
|
8892
|
-
}
|
|
8893
|
-
});
|
|
8894
|
-
return Array.from(symbols);
|
|
8895
|
-
}
|
|
8896
|
-
function compile(expression) {
|
|
8897
|
-
return (0, import_jsep.default)(expression);
|
|
8898
|
-
}
|
|
8899
8747
|
|
|
8900
8748
|
// src/fetch-map/layer-map.ts
|
|
8901
8749
|
init_cjs_shims();
|
|
@@ -9494,37 +9342,6 @@ function formatDate(value) {
|
|
|
9494
9342
|
function formatTimestamp(value) {
|
|
9495
9343
|
return String(Math.floor(new Date(value).getTime() / 1e3));
|
|
9496
9344
|
}
|
|
9497
|
-
function roundedPow10(exp) {
|
|
9498
|
-
const raw = Math.pow(10, exp);
|
|
9499
|
-
if (exp < 0) {
|
|
9500
|
-
const shift = Math.pow(10, -exp);
|
|
9501
|
-
return Math.round(raw * shift) / shift;
|
|
9502
|
-
}
|
|
9503
|
-
return raw;
|
|
9504
|
-
}
|
|
9505
|
-
function getLog10ScaleSteps({
|
|
9506
|
-
min: min2,
|
|
9507
|
-
max: max2,
|
|
9508
|
-
steps
|
|
9509
|
-
}) {
|
|
9510
|
-
if (min2 === 0) {
|
|
9511
|
-
if (max2 === Infinity) {
|
|
9512
|
-
return [...Array(steps - 1)].map((_v, i) => roundedPow10(i + 1));
|
|
9513
|
-
}
|
|
9514
|
-
const maxLog = Math.log10(max2);
|
|
9515
|
-
const endExponent = Math.ceil(maxLog);
|
|
9516
|
-
const startExponent = endExponent - steps + 1;
|
|
9517
|
-
return [...Array(steps - 1)].map(
|
|
9518
|
-
(_v, i) => roundedPow10(startExponent + i)
|
|
9519
|
-
);
|
|
9520
|
-
} else {
|
|
9521
|
-
const minLog = Math.log10(min2);
|
|
9522
|
-
const startExponent = Math.ceil(minLog) === minLog ? minLog + 1 : Math.ceil(minLog);
|
|
9523
|
-
return [...Array(steps - 1)].map(
|
|
9524
|
-
(_v, i) => roundedPow10(startExponent + i)
|
|
9525
|
-
);
|
|
9526
|
-
}
|
|
9527
|
-
}
|
|
9528
9345
|
|
|
9529
9346
|
// src/fetch-map/layer-map.ts
|
|
9530
9347
|
var SCALE_FUNCS = {
|
|
@@ -9541,19 +9358,7 @@ var SCALE_FUNCS = {
|
|
|
9541
9358
|
function identity2(v2) {
|
|
9542
9359
|
return v2;
|
|
9543
9360
|
}
|
|
9544
|
-
var hexToRGB = (c) => {
|
|
9545
|
-
const { r, g, b } = rgb(c);
|
|
9546
|
-
return [r, g, b];
|
|
9547
|
-
};
|
|
9548
|
-
var rgbToHex = (c) => {
|
|
9549
|
-
const [r, g, b] = c;
|
|
9550
|
-
const rStr = r.toString(16).padStart(2, "0");
|
|
9551
|
-
const gStr = g.toString(16).padStart(2, "0");
|
|
9552
|
-
const bStr = b.toString(16).padStart(2, "0");
|
|
9553
|
-
return `#${rStr}${gStr}${bStr}`.toUpperCase();
|
|
9554
|
-
};
|
|
9555
9361
|
var UNKNOWN_COLOR = "#868d91";
|
|
9556
|
-
var UNKNOWN_COLOR_RGB = hexToRGB(UNKNOWN_COLOR);
|
|
9557
9362
|
var OPACITY_MAP = {
|
|
9558
9363
|
getFillColor: "opacity",
|
|
9559
9364
|
getLineColor: "strokeOpacity",
|
|
@@ -9586,12 +9391,6 @@ var sharedPropMap = {
|
|
|
9586
9391
|
wireframe: "wireframe"
|
|
9587
9392
|
}
|
|
9588
9393
|
};
|
|
9589
|
-
var rasterPropsMap = {
|
|
9590
|
-
isVisible: "visible",
|
|
9591
|
-
visConfig: {
|
|
9592
|
-
opacity: "opacity"
|
|
9593
|
-
}
|
|
9594
|
-
};
|
|
9595
9394
|
var customMarkersPropsMap = {
|
|
9596
9395
|
color: "getIconColor",
|
|
9597
9396
|
visConfig: {
|
|
@@ -9635,12 +9434,6 @@ function getLayerProps(type, config2, dataset) {
|
|
|
9635
9434
|
`Outdated layer type: ${type}. Please open map in CARTO Builder to automatically migrate.`
|
|
9636
9435
|
);
|
|
9637
9436
|
}
|
|
9638
|
-
if (type === "raster") {
|
|
9639
|
-
return {
|
|
9640
|
-
propMap: rasterPropsMap,
|
|
9641
|
-
defaultProps: {}
|
|
9642
|
-
};
|
|
9643
|
-
}
|
|
9644
9437
|
let basePropMap = sharedPropMap;
|
|
9645
9438
|
if (config2.visConfig?.customMarkers) {
|
|
9646
9439
|
basePropMap = mergePropMaps(basePropMap, customMarkersPropsMap);
|
|
@@ -9661,19 +9454,16 @@ function getLayerProps(type, config2, dataset) {
|
|
|
9661
9454
|
}
|
|
9662
9455
|
function domainFromAttribute(attribute, scaleType, scaleLength) {
|
|
9663
9456
|
if (scaleType === "ordinal" || scaleType === "point") {
|
|
9664
|
-
if (!attribute.categories) {
|
|
9665
|
-
return [0, 1];
|
|
9666
|
-
}
|
|
9667
9457
|
return attribute.categories.map((c) => c.category).filter((c) => c !== void 0 && c !== null);
|
|
9668
9458
|
}
|
|
9669
9459
|
if (scaleType === "quantile" && attribute.quantiles) {
|
|
9670
|
-
return
|
|
9460
|
+
return attribute.quantiles.global ? attribute.quantiles.global[scaleLength] : attribute.quantiles[scaleLength];
|
|
9671
9461
|
}
|
|
9672
9462
|
let { min: min2 } = attribute;
|
|
9673
9463
|
if (scaleType === "log" && min2 === 0) {
|
|
9674
9464
|
min2 = 1e-5;
|
|
9675
9465
|
}
|
|
9676
|
-
return [min2
|
|
9466
|
+
return [min2, attribute.max];
|
|
9677
9467
|
}
|
|
9678
9468
|
function domainFromValues(values, scaleType) {
|
|
9679
9469
|
if (scaleType === "ordinal" || scaleType === "point") {
|
|
@@ -9694,14 +9484,12 @@ function calculateDomain(data, name, scaleType, scaleLength) {
|
|
|
9694
9484
|
if (data.tilestats) {
|
|
9695
9485
|
const { attributes } = data.tilestats.layers[0];
|
|
9696
9486
|
const attribute = attributes.find((a) => a.attribute === name);
|
|
9697
|
-
|
|
9698
|
-
return domainFromAttribute(attribute, scaleType, scaleLength);
|
|
9699
|
-
}
|
|
9487
|
+
return domainFromAttribute(attribute, scaleType, scaleLength);
|
|
9700
9488
|
}
|
|
9701
9489
|
return [0, 1];
|
|
9702
9490
|
}
|
|
9703
9491
|
function normalizeAccessor(accessor, data) {
|
|
9704
|
-
if (data.features || data.tilestats
|
|
9492
|
+
if (data.features || data.tilestats) {
|
|
9705
9493
|
return (object, info) => {
|
|
9706
9494
|
if (object) {
|
|
9707
9495
|
return accessor(object.properties || object.__source.object.properties);
|
|
@@ -9734,7 +9522,7 @@ function findAccessorKey(keys, properties) {
|
|
|
9734
9522
|
return keys;
|
|
9735
9523
|
}
|
|
9736
9524
|
function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
|
|
9737
|
-
const
|
|
9525
|
+
const scale2 = calculateLayerScale(
|
|
9738
9526
|
colorColumn || name,
|
|
9739
9527
|
scaleType,
|
|
9740
9528
|
range,
|
|
@@ -9747,61 +9535,33 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
|
|
|
9747
9535
|
accessorKeys = findAccessorKey(accessorKeys, properties);
|
|
9748
9536
|
}
|
|
9749
9537
|
const propertyValue = properties[accessorKeys[0]];
|
|
9750
|
-
const
|
|
9538
|
+
const { r, g, b } = rgb(scale2(propertyValue));
|
|
9751
9539
|
return [r, g, b, propertyValue === null ? 0 : alpha];
|
|
9752
9540
|
};
|
|
9753
|
-
return {
|
|
9754
|
-
accessor: normalizeAccessor(accessor, data),
|
|
9755
|
-
scaleDomain: scale2.domain(),
|
|
9756
|
-
domain,
|
|
9757
|
-
range: scale2.range().map(rgbToHex)
|
|
9758
|
-
};
|
|
9541
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9759
9542
|
}
|
|
9760
9543
|
function calculateLayerScale(name, scaleType, range, data) {
|
|
9544
|
+
const scale2 = SCALE_FUNCS[scaleType]();
|
|
9761
9545
|
let domain = [];
|
|
9762
|
-
let scaleDomain;
|
|
9763
9546
|
let scaleColor = [];
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
const [min2, max2] = domain;
|
|
9768
|
-
if (range.uiCustomScaleType === "logarithmic") {
|
|
9769
|
-
scaleDomain = getLog10ScaleSteps({
|
|
9770
|
-
min: min2,
|
|
9771
|
-
max: max2,
|
|
9772
|
-
steps: colors.length
|
|
9773
|
-
});
|
|
9774
|
-
scaleColor = colors;
|
|
9775
|
-
} else if (range.colorMap) {
|
|
9776
|
-
const { colorMap } = range;
|
|
9777
|
-
scaleDomain = [];
|
|
9547
|
+
if (scaleType !== "identity") {
|
|
9548
|
+
const { colorMap, colors } = range;
|
|
9549
|
+
if (Array.isArray(colorMap)) {
|
|
9778
9550
|
colorMap.forEach(([value, color2]) => {
|
|
9779
|
-
|
|
9551
|
+
domain.push(value);
|
|
9780
9552
|
scaleColor.push(color2);
|
|
9781
9553
|
});
|
|
9554
|
+
} else {
|
|
9555
|
+
domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9556
|
+
scaleColor = colors;
|
|
9782
9557
|
}
|
|
9783
|
-
} else if (scaleType !== "identity") {
|
|
9784
|
-
domain = calculateDomain(data, name, scaleType, colors.length);
|
|
9785
|
-
scaleColor = colors;
|
|
9786
9558
|
if (scaleType === "ordinal") {
|
|
9787
9559
|
domain = domain.slice(0, scaleColor.length);
|
|
9788
9560
|
}
|
|
9789
9561
|
}
|
|
9790
|
-
return {
|
|
9791
|
-
scale: createColorScale(
|
|
9792
|
-
scaleType,
|
|
9793
|
-
scaleDomain || domain,
|
|
9794
|
-
scaleColor.map(hexToRGB),
|
|
9795
|
-
UNKNOWN_COLOR_RGB
|
|
9796
|
-
),
|
|
9797
|
-
domain
|
|
9798
|
-
};
|
|
9799
|
-
}
|
|
9800
|
-
function createColorScale(scaleType, domain, range, unknown) {
|
|
9801
|
-
const scale2 = SCALE_FUNCS[scaleType]();
|
|
9802
9562
|
scale2.domain(domain);
|
|
9803
|
-
scale2.range(
|
|
9804
|
-
scale2.unknown(
|
|
9563
|
+
scale2.range(scaleColor);
|
|
9564
|
+
scale2.unknown(UNKNOWN_COLOR);
|
|
9805
9565
|
return scale2;
|
|
9806
9566
|
}
|
|
9807
9567
|
var FALLBACK_ICON = "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==";
|
|
@@ -9851,13 +9611,9 @@ function negateAccessor(accessor) {
|
|
|
9851
9611
|
}
|
|
9852
9612
|
function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
|
|
9853
9613
|
const scale2 = scaleType ? SCALE_FUNCS[scaleType]() : identity2;
|
|
9854
|
-
|
|
9855
|
-
if (scaleType && range) {
|
|
9614
|
+
if (scaleType) {
|
|
9856
9615
|
if (aggregation !== AggregationTypes.Count) {
|
|
9857
|
-
domain
|
|
9858
|
-
scale2.domain(domain);
|
|
9859
|
-
} else {
|
|
9860
|
-
domain = scale2.domain();
|
|
9616
|
+
scale2.domain(calculateDomain(data, name, scaleType));
|
|
9861
9617
|
}
|
|
9862
9618
|
scale2.range(range);
|
|
9863
9619
|
}
|
|
@@ -9869,12 +9625,7 @@ function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
|
|
|
9869
9625
|
const propertyValue = properties[accessorKeys[0]];
|
|
9870
9626
|
return scale2(propertyValue);
|
|
9871
9627
|
};
|
|
9872
|
-
return {
|
|
9873
|
-
accessor: normalizeAccessor(accessor, data),
|
|
9874
|
-
domain,
|
|
9875
|
-
scaleDomain: domain,
|
|
9876
|
-
range
|
|
9877
|
-
};
|
|
9628
|
+
return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
|
|
9878
9629
|
}
|
|
9879
9630
|
var FORMATS = {
|
|
9880
9631
|
date: formatDate,
|
|
@@ -9925,424 +9676,13 @@ function calculateClusterTextFontSize(radius) {
|
|
|
9925
9676
|
return 11;
|
|
9926
9677
|
}
|
|
9927
9678
|
|
|
9928
|
-
// src/fetch-map/raster-layer.ts
|
|
9929
|
-
var UNKNOWN_COLOR2 = [134, 141, 145];
|
|
9930
|
-
var RASTER_COLOR_BANDS = ["red", "green", "blue"];
|
|
9931
|
-
function getHasDataPredicate(noData) {
|
|
9932
|
-
if (noData === "nan") {
|
|
9933
|
-
return (v2) => !isNaN(v2);
|
|
9934
|
-
}
|
|
9935
|
-
if (typeof noData === "string") {
|
|
9936
|
-
noData = parseFloat(noData);
|
|
9937
|
-
}
|
|
9938
|
-
if (typeof noData === "number") {
|
|
9939
|
-
return (v2) => v2 !== noData && !isNaN(v2);
|
|
9940
|
-
}
|
|
9941
|
-
return () => true;
|
|
9942
|
-
}
|
|
9943
|
-
function createRasterColumnLayerDataTransform(transform) {
|
|
9944
|
-
return (data) => {
|
|
9945
|
-
if (!data || !("data" in data) || !data?.data?.cells?.numericProps) {
|
|
9946
|
-
return data;
|
|
9947
|
-
}
|
|
9948
|
-
return transform(data);
|
|
9949
|
-
};
|
|
9950
|
-
}
|
|
9951
|
-
function createEvaluationContext(numericProps, noData) {
|
|
9952
|
-
const hasData = getHasDataPredicate(noData);
|
|
9953
|
-
const bands = Object.entries(numericProps).map(([bandName, { value }]) => ({
|
|
9954
|
-
bandName,
|
|
9955
|
-
values: value,
|
|
9956
|
-
copied: false
|
|
9957
|
-
}));
|
|
9958
|
-
const length2 = bands[0].values.length;
|
|
9959
|
-
for (let i = 0; i < length2; i++) {
|
|
9960
|
-
let hasSomeData = false;
|
|
9961
|
-
for (let j = 0; j < bands.length; j++) {
|
|
9962
|
-
hasSomeData = hasSomeData || hasData(bands[j].values[i]);
|
|
9963
|
-
}
|
|
9964
|
-
if (!hasSomeData) {
|
|
9965
|
-
for (let j = 0; j < bands.length; j++) {
|
|
9966
|
-
if (!bands[j].copied) {
|
|
9967
|
-
bands[j].copied = true;
|
|
9968
|
-
bands[j].values = Array.from(bands[j].values);
|
|
9969
|
-
}
|
|
9970
|
-
bands[j].values[i] = NaN;
|
|
9971
|
-
}
|
|
9972
|
-
}
|
|
9973
|
-
}
|
|
9974
|
-
const context = bands.reduce(
|
|
9975
|
-
(agg, { bandName, values }) => {
|
|
9976
|
-
agg[bandName] = values;
|
|
9977
|
-
return agg;
|
|
9978
|
-
},
|
|
9979
|
-
{}
|
|
9980
|
-
);
|
|
9981
|
-
return context;
|
|
9982
|
-
}
|
|
9983
|
-
function createExprDataTransform({
|
|
9984
|
-
colorBand,
|
|
9985
|
-
rasterMetadata,
|
|
9986
|
-
usedSymbols
|
|
9987
|
-
}) {
|
|
9988
|
-
if (!colorBand || !colorBand.type || colorBand.type === "none") {
|
|
9989
|
-
return void 0;
|
|
9990
|
-
}
|
|
9991
|
-
const expr = colorBand?.type === "expression" ? colorBand.value : void 0;
|
|
9992
|
-
const vecExprEvaluator = expr ? createVecExprEvaluator(expr) : void 0;
|
|
9993
|
-
const dataTransform = createRasterColumnLayerDataTransform(
|
|
9994
|
-
(dataWrapped) => {
|
|
9995
|
-
const data = dataWrapped.data;
|
|
9996
|
-
if (expr) {
|
|
9997
|
-
const cachedResult = dataWrapped.customExpressionResults?.[expr];
|
|
9998
|
-
if (cachedResult) {
|
|
9999
|
-
return dataWrapped;
|
|
10000
|
-
}
|
|
10001
|
-
}
|
|
10002
|
-
let context = dataWrapped.expressionEvalContext;
|
|
10003
|
-
if (!context) {
|
|
10004
|
-
const usedNumericProps = usedSymbols.reduce(
|
|
10005
|
-
(acc, symbol) => {
|
|
10006
|
-
acc[symbol] = data.cells.numericProps[symbol];
|
|
10007
|
-
return acc;
|
|
10008
|
-
},
|
|
10009
|
-
{}
|
|
10010
|
-
);
|
|
10011
|
-
context = createEvaluationContext(
|
|
10012
|
-
usedNumericProps,
|
|
10013
|
-
rasterMetadata.nodata
|
|
10014
|
-
);
|
|
10015
|
-
dataWrapped = {
|
|
10016
|
-
...dataWrapped,
|
|
10017
|
-
expressionEvalContext: context
|
|
10018
|
-
};
|
|
10019
|
-
}
|
|
10020
|
-
if (!vecExprEvaluator || !expr) return dataWrapped;
|
|
10021
|
-
const evalResult = vecExprEvaluator(context);
|
|
10022
|
-
return {
|
|
10023
|
-
...dataWrapped,
|
|
10024
|
-
customExpressionResults: {
|
|
10025
|
-
...dataWrapped.customExpressionResults,
|
|
10026
|
-
[expr]: evalResult
|
|
10027
|
-
}
|
|
10028
|
-
};
|
|
10029
|
-
}
|
|
10030
|
-
);
|
|
10031
|
-
return dataTransform;
|
|
10032
|
-
}
|
|
10033
|
-
function combineDataTransforms(dataTransforms) {
|
|
10034
|
-
const actualTransforms = dataTransforms.filter((v2) => v2);
|
|
10035
|
-
if (actualTransforms.length === 0) return void 0;
|
|
10036
|
-
if (actualTransforms.length === 1) return actualTransforms[0];
|
|
10037
|
-
return (data) => actualTransforms.reduce(
|
|
10038
|
-
(aggData, transformFun) => transformFun(aggData),
|
|
10039
|
-
data
|
|
10040
|
-
);
|
|
10041
|
-
}
|
|
10042
|
-
function createRgbToColorBufferDataTransform({
|
|
10043
|
-
bandDefs,
|
|
10044
|
-
attribute
|
|
10045
|
-
}) {
|
|
10046
|
-
return createRasterColumnLayerDataTransform(
|
|
10047
|
-
(dataWrapped) => {
|
|
10048
|
-
const length2 = dataWrapped.length;
|
|
10049
|
-
const getBandBufferOrValue = (colorBand) => {
|
|
10050
|
-
if (colorBand?.type === "expression") {
|
|
10051
|
-
return dataWrapped.customExpressionResults?.[colorBand.value];
|
|
10052
|
-
}
|
|
10053
|
-
if (colorBand?.type === "band") {
|
|
10054
|
-
return dataWrapped.expressionEvalContext?.[colorBand.value];
|
|
10055
|
-
}
|
|
10056
|
-
return 0;
|
|
10057
|
-
};
|
|
10058
|
-
const red = getBandBufferOrValue(bandDefs.red);
|
|
10059
|
-
const green = getBandBufferOrValue(bandDefs.green);
|
|
10060
|
-
const blue = getBandBufferOrValue(bandDefs.blue);
|
|
10061
|
-
const colorBuffer = new Uint8Array(length2 * 4);
|
|
10062
|
-
for (let inputIndex = 0, outputIndex = 0; inputIndex < length2; inputIndex++, outputIndex += 4) {
|
|
10063
|
-
const redRaw = typeof red === "number" ? red : red ? red[inputIndex] : NaN;
|
|
10064
|
-
const greenRaw = typeof green === "number" ? green : green ? green[inputIndex] : NaN;
|
|
10065
|
-
const blueRaw = typeof blue === "number" ? blue : blue ? blue[inputIndex] : NaN;
|
|
10066
|
-
if (isNaN(redRaw) && isNaN(greenRaw) && isNaN(blueRaw)) {
|
|
10067
|
-
bufferSetRgba(colorBuffer, outputIndex, 0, 0, 0, 0);
|
|
10068
|
-
} else {
|
|
10069
|
-
bufferSetRgba(
|
|
10070
|
-
colorBuffer,
|
|
10071
|
-
outputIndex,
|
|
10072
|
-
redRaw,
|
|
10073
|
-
greenRaw,
|
|
10074
|
-
blueRaw,
|
|
10075
|
-
255
|
|
10076
|
-
);
|
|
10077
|
-
}
|
|
10078
|
-
}
|
|
10079
|
-
dataWrapped.customExpressionResults = void 0;
|
|
10080
|
-
dataWrapped.expressionEvalContext = void 0;
|
|
10081
|
-
return {
|
|
10082
|
-
...dataWrapped,
|
|
10083
|
-
attributes: {
|
|
10084
|
-
[attribute]: colorBuffer
|
|
10085
|
-
}
|
|
10086
|
-
};
|
|
10087
|
-
}
|
|
10088
|
-
);
|
|
10089
|
-
}
|
|
10090
|
-
function getUsedSymbols(colorBands) {
|
|
10091
|
-
return Array.from(
|
|
10092
|
-
colorBands.reduce((symbols, band) => {
|
|
10093
|
-
if (band.type === "expression") {
|
|
10094
|
-
const expressionSymbols = createVecExprEvaluator(band.value)?.symbols || [];
|
|
10095
|
-
expressionSymbols.forEach((symbol) => symbols.add(symbol));
|
|
10096
|
-
}
|
|
10097
|
-
if (band.type === "band") {
|
|
10098
|
-
symbols.add(band.value);
|
|
10099
|
-
}
|
|
10100
|
-
return symbols;
|
|
10101
|
-
}, /* @__PURE__ */ new Set())
|
|
10102
|
-
);
|
|
10103
|
-
}
|
|
10104
|
-
function getRasterTileLayerStylePropsRgb({
|
|
10105
|
-
layerConfig,
|
|
10106
|
-
rasterMetadata,
|
|
10107
|
-
visualChannels
|
|
10108
|
-
}) {
|
|
10109
|
-
const { visConfig } = layerConfig;
|
|
10110
|
-
const { colorBands } = visConfig;
|
|
10111
|
-
const bandDefs = {
|
|
10112
|
-
red: colorBands?.find((band) => band.band === "red"),
|
|
10113
|
-
green: colorBands?.find((band) => band.band === "green"),
|
|
10114
|
-
blue: colorBands?.find((band) => band.band === "blue")
|
|
10115
|
-
};
|
|
10116
|
-
const rgbToInstanceFillColorsDataTransform = createRgbToColorBufferDataTransform({
|
|
10117
|
-
bandDefs,
|
|
10118
|
-
attribute: "instanceFillColors"
|
|
10119
|
-
});
|
|
10120
|
-
const usedSymbols = colorBands ? getUsedSymbols(colorBands) : [];
|
|
10121
|
-
const bandTransforms = RASTER_COLOR_BANDS.map(
|
|
10122
|
-
(band) => createExprDataTransform({
|
|
10123
|
-
colorBand: bandDefs[band],
|
|
10124
|
-
rasterMetadata,
|
|
10125
|
-
usedSymbols
|
|
10126
|
-
})
|
|
10127
|
-
);
|
|
10128
|
-
const combinedDataTransform = combineDataTransforms([
|
|
10129
|
-
...bandTransforms,
|
|
10130
|
-
rgbToInstanceFillColorsDataTransform
|
|
10131
|
-
]);
|
|
10132
|
-
return {
|
|
10133
|
-
dataTransform: combinedDataTransform,
|
|
10134
|
-
updateTriggers: getRasterTileLayerUpdateTriggers({
|
|
10135
|
-
layerConfig,
|
|
10136
|
-
visualChannels
|
|
10137
|
-
})
|
|
10138
|
-
};
|
|
10139
|
-
}
|
|
10140
|
-
function createBandColorScaleDataTransform({
|
|
10141
|
-
bandName,
|
|
10142
|
-
scaleFun,
|
|
10143
|
-
nodata,
|
|
10144
|
-
attribute
|
|
10145
|
-
}) {
|
|
10146
|
-
const hasData = getHasDataPredicate(nodata);
|
|
10147
|
-
return createRasterColumnLayerDataTransform(
|
|
10148
|
-
(dataWrapped) => {
|
|
10149
|
-
const length2 = dataWrapped.length;
|
|
10150
|
-
const bandBuffer = dataWrapped.data.cells.numericProps[bandName].value;
|
|
10151
|
-
const colorBuffer = new Uint8Array(length2 * 4);
|
|
10152
|
-
for (let i = 0; i < length2; i++) {
|
|
10153
|
-
const rawValue = bandBuffer[i];
|
|
10154
|
-
if (!hasData(rawValue)) {
|
|
10155
|
-
bufferSetRgba(colorBuffer, i * 4, 0, 0, 0, 0);
|
|
10156
|
-
} else {
|
|
10157
|
-
const colorRgb = scaleFun(rawValue);
|
|
10158
|
-
bufferSetRgba(
|
|
10159
|
-
colorBuffer,
|
|
10160
|
-
i * 4,
|
|
10161
|
-
colorRgb[0],
|
|
10162
|
-
colorRgb[1],
|
|
10163
|
-
colorRgb[2],
|
|
10164
|
-
255
|
|
10165
|
-
);
|
|
10166
|
-
}
|
|
10167
|
-
}
|
|
10168
|
-
return {
|
|
10169
|
-
...dataWrapped,
|
|
10170
|
-
attributes: {
|
|
10171
|
-
[attribute]: colorBuffer
|
|
10172
|
-
}
|
|
10173
|
-
};
|
|
10174
|
-
}
|
|
10175
|
-
);
|
|
10176
|
-
}
|
|
10177
|
-
function domainFromRasterMetadataBand(band, scaleType, colorRange) {
|
|
10178
|
-
if (scaleType === "ordinal") {
|
|
10179
|
-
return colorRange.colorMap?.map(([value]) => value) || [];
|
|
10180
|
-
}
|
|
10181
|
-
if (scaleType === "custom") {
|
|
10182
|
-
if (colorRange.uiCustomScaleType === "logarithmic") {
|
|
10183
|
-
return getLog10ScaleSteps({
|
|
10184
|
-
min: band.stats.min,
|
|
10185
|
-
max: band.stats.max,
|
|
10186
|
-
steps: colorRange.colors.length
|
|
10187
|
-
});
|
|
10188
|
-
} else {
|
|
10189
|
-
return colorRange.colorMap?.map(([value]) => value) || [];
|
|
10190
|
-
}
|
|
10191
|
-
}
|
|
10192
|
-
const scaleLength = colorRange.colors.length;
|
|
10193
|
-
if (scaleType === "quantile") {
|
|
10194
|
-
const quantiles = band.stats.quantiles?.[scaleLength];
|
|
10195
|
-
if (!quantiles) {
|
|
10196
|
-
return [0, 1];
|
|
10197
|
-
}
|
|
10198
|
-
return [band.stats.min, ...quantiles, band.stats.max];
|
|
10199
|
-
}
|
|
10200
|
-
return [band.stats.min, band.stats.max];
|
|
10201
|
-
}
|
|
10202
|
-
function getRasterTileLayerStylePropsScaledBand({
|
|
10203
|
-
layerConfig,
|
|
10204
|
-
rasterMetadata,
|
|
10205
|
-
visualChannels
|
|
10206
|
-
}) {
|
|
10207
|
-
const { visConfig } = layerConfig;
|
|
10208
|
-
const { colorField } = visualChannels;
|
|
10209
|
-
const { rasterStyleType } = visConfig;
|
|
10210
|
-
const colorRange = rasterStyleType === "ColorRange" ? visConfig.colorRange : visConfig.uniqueValuesColorRange;
|
|
10211
|
-
const scaleType = rasterStyleType === "ColorRange" ? visualChannels.colorScale : "ordinal";
|
|
10212
|
-
const bandInfo = rasterMetadata.bands.find(
|
|
10213
|
-
(band) => band.name === colorField?.name
|
|
10214
|
-
);
|
|
10215
|
-
if (!colorField?.name || !scaleType || !colorRange || !bandInfo) {
|
|
10216
|
-
return {};
|
|
10217
|
-
}
|
|
10218
|
-
const domain = domainFromRasterMetadataBand(bandInfo, scaleType, colorRange);
|
|
10219
|
-
const scaleFun = createColorScale(
|
|
10220
|
-
scaleType,
|
|
10221
|
-
domain,
|
|
10222
|
-
colorRange.colors.map(hexToRGB2),
|
|
10223
|
-
UNKNOWN_COLOR2
|
|
10224
|
-
);
|
|
10225
|
-
const bandColorScaleDataTransform = createBandColorScaleDataTransform({
|
|
10226
|
-
bandName: bandInfo.name,
|
|
10227
|
-
scaleFun,
|
|
10228
|
-
nodata: bandInfo?.nodata ?? rasterMetadata.nodata,
|
|
10229
|
-
attribute: "instanceFillColors"
|
|
10230
|
-
});
|
|
10231
|
-
return {
|
|
10232
|
-
dataTransform: bandColorScaleDataTransform,
|
|
10233
|
-
updateTriggers: getRasterTileLayerUpdateTriggers({
|
|
10234
|
-
layerConfig,
|
|
10235
|
-
visualChannels
|
|
10236
|
-
})
|
|
10237
|
-
};
|
|
10238
|
-
}
|
|
10239
|
-
function getRasterTileLayerStyleProps({
|
|
10240
|
-
layerConfig,
|
|
10241
|
-
visualChannels,
|
|
10242
|
-
rasterMetadata
|
|
10243
|
-
}) {
|
|
10244
|
-
const { visConfig } = layerConfig;
|
|
10245
|
-
const { rasterStyleType } = visConfig;
|
|
10246
|
-
if (rasterStyleType === "Rgb") {
|
|
10247
|
-
return getRasterTileLayerStylePropsRgb({
|
|
10248
|
-
layerConfig,
|
|
10249
|
-
rasterMetadata,
|
|
10250
|
-
visualChannels
|
|
10251
|
-
});
|
|
10252
|
-
} else {
|
|
10253
|
-
return getRasterTileLayerStylePropsScaledBand({
|
|
10254
|
-
layerConfig,
|
|
10255
|
-
rasterMetadata,
|
|
10256
|
-
visualChannels
|
|
10257
|
-
});
|
|
10258
|
-
}
|
|
10259
|
-
}
|
|
10260
|
-
function getRasterTileLayerUpdateTriggers({
|
|
10261
|
-
layerConfig,
|
|
10262
|
-
visualChannels
|
|
10263
|
-
}) {
|
|
10264
|
-
const { visConfig } = layerConfig;
|
|
10265
|
-
const { rasterStyleType } = visConfig;
|
|
10266
|
-
const getFillColorUpdateTriggers = {
|
|
10267
|
-
rasterStyleType
|
|
10268
|
-
};
|
|
10269
|
-
if (rasterStyleType === "ColorRange") {
|
|
10270
|
-
getFillColorUpdateTriggers.colorRange = visConfig.colorRange?.colors;
|
|
10271
|
-
getFillColorUpdateTriggers.colorMap = visConfig.colorRange?.colorMap;
|
|
10272
|
-
getFillColorUpdateTriggers.colorScale = visualChannels.colorScale;
|
|
10273
|
-
getFillColorUpdateTriggers.colorFieldId = visualChannels.colorField?.name;
|
|
10274
|
-
} else if (rasterStyleType === "UniqueValues") {
|
|
10275
|
-
getFillColorUpdateTriggers.colorMap = visConfig.uniqueValuesColorRange?.colorMap;
|
|
10276
|
-
getFillColorUpdateTriggers.colorFieldId = visualChannels.colorField?.name;
|
|
10277
|
-
} else if (rasterStyleType === "Rgb") {
|
|
10278
|
-
getFillColorUpdateTriggers.colorBands = visConfig.colorBands;
|
|
10279
|
-
}
|
|
10280
|
-
return {
|
|
10281
|
-
getFillColor: getFillColorUpdateTriggers
|
|
10282
|
-
};
|
|
10283
|
-
}
|
|
10284
|
-
function bufferSetRgba(target, index, r, g, b, a) {
|
|
10285
|
-
target[index + 0] = r;
|
|
10286
|
-
target[index + 1] = g;
|
|
10287
|
-
target[index + 2] = b;
|
|
10288
|
-
target[index + 3] = a;
|
|
10289
|
-
}
|
|
10290
|
-
function hexToRGB2(hexColor) {
|
|
10291
|
-
const r = parseInt(hexColor.slice(1, 3), 16);
|
|
10292
|
-
const g = parseInt(hexColor.slice(3, 5), 16);
|
|
10293
|
-
const b = parseInt(hexColor.slice(5, 7), 16);
|
|
10294
|
-
return [r, g, b];
|
|
10295
|
-
}
|
|
10296
|
-
|
|
10297
|
-
// src/fetch-map/fetch-map.ts
|
|
10298
|
-
init_cjs_shims();
|
|
10299
|
-
|
|
10300
9679
|
// src/fetch-map/parse-map.ts
|
|
10301
|
-
init_cjs_shims();
|
|
10302
|
-
function getLayerDescriptor({
|
|
10303
|
-
mapConfig,
|
|
10304
|
-
layer,
|
|
10305
|
-
dataset
|
|
10306
|
-
}) {
|
|
10307
|
-
const { filters, visState } = mapConfig;
|
|
10308
|
-
const { layerBlending, interactionConfig } = visState;
|
|
10309
|
-
const { id, type, config: config2, visualChannels } = layer;
|
|
10310
|
-
const { data, id: datasetId } = dataset;
|
|
10311
|
-
const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config2, dataset);
|
|
10312
|
-
const styleProps = createStyleProps(config2, propMap);
|
|
10313
|
-
const { channelProps, scales } = createChannelProps(
|
|
10314
|
-
id,
|
|
10315
|
-
type,
|
|
10316
|
-
config2,
|
|
10317
|
-
visualChannels,
|
|
10318
|
-
data,
|
|
10319
|
-
dataset
|
|
10320
|
-
);
|
|
10321
|
-
const layerDescriptor = {
|
|
10322
|
-
type,
|
|
10323
|
-
filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[datasetId],
|
|
10324
|
-
props: {
|
|
10325
|
-
id,
|
|
10326
|
-
data,
|
|
10327
|
-
...defaultProps2,
|
|
10328
|
-
...createInteractionProps(interactionConfig),
|
|
10329
|
-
...styleProps,
|
|
10330
|
-
...channelProps,
|
|
10331
|
-
...createParametersProp(layerBlending, styleProps.parameters || {}),
|
|
10332
|
-
// Must come after style
|
|
10333
|
-
...createLoadOptions(data.accessToken)
|
|
10334
|
-
},
|
|
10335
|
-
scales
|
|
10336
|
-
};
|
|
10337
|
-
return layerDescriptor;
|
|
10338
|
-
}
|
|
10339
9680
|
function parseMap(json) {
|
|
10340
9681
|
const { keplerMapConfig, datasets, token } = json;
|
|
10341
9682
|
assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
|
|
10342
|
-
const
|
|
10343
|
-
const { mapState, mapStyle, popupSettings, legendSettings
|
|
10344
|
-
const { layers } = visState;
|
|
10345
|
-
const layersReverse = [...layers].reverse();
|
|
9683
|
+
const config2 = keplerMapConfig.config;
|
|
9684
|
+
const { filters, mapState, mapStyle, popupSettings, legendSettings } = config2;
|
|
9685
|
+
const { layers, layerBlending, interactionConfig } = config2.visState;
|
|
10346
9686
|
return {
|
|
10347
9687
|
id: json.id,
|
|
10348
9688
|
title: json.title,
|
|
@@ -10355,19 +9695,45 @@ function parseMap(json) {
|
|
|
10355
9695
|
popupSettings,
|
|
10356
9696
|
legendSettings,
|
|
10357
9697
|
token,
|
|
10358
|
-
layers:
|
|
9698
|
+
layers: layers.reverse().map(({ id, type, config: config3, visualChannels }) => {
|
|
10359
9699
|
try {
|
|
10360
|
-
const { dataId } =
|
|
9700
|
+
const { dataId } = config3;
|
|
10361
9701
|
const dataset = datasets.find(
|
|
10362
9702
|
(d) => d.id === dataId
|
|
10363
9703
|
);
|
|
10364
9704
|
assert2(dataset, `No dataset matching dataId: ${dataId}`);
|
|
10365
|
-
const
|
|
10366
|
-
|
|
10367
|
-
|
|
9705
|
+
const { data } = dataset;
|
|
9706
|
+
assert2(data, `No data loaded for dataId: ${dataId}`);
|
|
9707
|
+
const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config3, dataset);
|
|
9708
|
+
const styleProps = createStyleProps(config3, propMap);
|
|
9709
|
+
const { channelProps, scales } = createChannelProps(
|
|
9710
|
+
id,
|
|
9711
|
+
type,
|
|
9712
|
+
config3,
|
|
9713
|
+
visualChannels,
|
|
9714
|
+
data,
|
|
10368
9715
|
dataset
|
|
10369
|
-
|
|
10370
|
-
|
|
9716
|
+
);
|
|
9717
|
+
const layer = {
|
|
9718
|
+
type,
|
|
9719
|
+
filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[dataId],
|
|
9720
|
+
props: {
|
|
9721
|
+
id,
|
|
9722
|
+
data,
|
|
9723
|
+
...defaultProps2,
|
|
9724
|
+
...createInteractionProps(interactionConfig),
|
|
9725
|
+
...styleProps,
|
|
9726
|
+
...channelProps,
|
|
9727
|
+
...createParametersProp(
|
|
9728
|
+
layerBlending,
|
|
9729
|
+
styleProps.parameters || {}
|
|
9730
|
+
),
|
|
9731
|
+
// Must come after style
|
|
9732
|
+
...createLoadOptions(token)
|
|
9733
|
+
},
|
|
9734
|
+
scales
|
|
9735
|
+
};
|
|
9736
|
+
return layer;
|
|
10371
9737
|
} catch (e) {
|
|
10372
9738
|
console.error(e.message);
|
|
10373
9739
|
return void 0;
|
|
@@ -10432,63 +9798,43 @@ function createStyleProps(config2, mapping) {
|
|
|
10432
9798
|
result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
|
|
10433
9799
|
return result;
|
|
10434
9800
|
}
|
|
9801
|
+
function domainAndRangeFromScale(scale2) {
|
|
9802
|
+
return {
|
|
9803
|
+
domain: scale2.domain(),
|
|
9804
|
+
range: scale2.range()
|
|
9805
|
+
};
|
|
9806
|
+
}
|
|
10435
9807
|
function createChannelProps(id, layerType, config2, visualChannels, data, dataset) {
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
return {
|
|
10447
|
-
channelProps: getRasterTileLayerStylePropsRgb({
|
|
10448
|
-
layerConfig: config2,
|
|
10449
|
-
rasterMetadata,
|
|
10450
|
-
visualChannels
|
|
10451
|
-
}),
|
|
10452
|
-
scales: {}
|
|
10453
|
-
// TODO
|
|
10454
|
-
};
|
|
10455
|
-
} else {
|
|
10456
|
-
return {
|
|
10457
|
-
channelProps: getRasterTileLayerStylePropsScaledBand({
|
|
10458
|
-
layerConfig: config2,
|
|
10459
|
-
visualChannels,
|
|
10460
|
-
rasterMetadata
|
|
10461
|
-
}),
|
|
10462
|
-
scales: {
|
|
10463
|
-
// TODO
|
|
10464
|
-
}
|
|
10465
|
-
};
|
|
10466
|
-
}
|
|
10467
|
-
}
|
|
9808
|
+
const {
|
|
9809
|
+
colorField,
|
|
9810
|
+
colorScale,
|
|
9811
|
+
radiusField,
|
|
9812
|
+
radiusScale,
|
|
9813
|
+
strokeColorField,
|
|
9814
|
+
strokeColorScale,
|
|
9815
|
+
weightField
|
|
9816
|
+
} = visualChannels;
|
|
9817
|
+
const { heightField, heightScale } = visualChannels;
|
|
10468
9818
|
const { textLabel, visConfig } = config2;
|
|
10469
9819
|
const result = {};
|
|
10470
|
-
const updateTriggers = {};
|
|
10471
9820
|
const scales = {};
|
|
10472
|
-
{
|
|
10473
|
-
const {
|
|
10474
|
-
const {
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
} else {
|
|
10490
|
-
scales.fillColor = {};
|
|
10491
|
-
}
|
|
9821
|
+
if (colorField) {
|
|
9822
|
+
const { colorAggregation: aggregation, colorRange: range } = visConfig;
|
|
9823
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9824
|
+
colorField,
|
|
9825
|
+
colorScale,
|
|
9826
|
+
{ aggregation, range },
|
|
9827
|
+
visConfig.opacity,
|
|
9828
|
+
data
|
|
9829
|
+
);
|
|
9830
|
+
result.getFillColor = accessor;
|
|
9831
|
+
scales.fillColor = {
|
|
9832
|
+
field: colorField,
|
|
9833
|
+
type: colorScale,
|
|
9834
|
+
...domainAndRangeFromScale(scale2)
|
|
9835
|
+
};
|
|
9836
|
+
} else if (visConfig.filled) {
|
|
9837
|
+
scales.fillColor = {};
|
|
10492
9838
|
}
|
|
10493
9839
|
if (layerType === "clusterTile") {
|
|
10494
9840
|
const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
|
|
@@ -10501,7 +9847,6 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10501
9847
|
result.getWeight = (d) => {
|
|
10502
9848
|
return d.properties[aggregationExpAlias];
|
|
10503
9849
|
};
|
|
10504
|
-
updateTriggers.getWeight = aggregationExpAlias;
|
|
10505
9850
|
result.getPointRadius = (d, info) => {
|
|
10506
9851
|
return calculateClusterRadius(
|
|
10507
9852
|
d.properties,
|
|
@@ -10510,16 +9855,11 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10510
9855
|
aggregationExpAlias
|
|
10511
9856
|
);
|
|
10512
9857
|
};
|
|
10513
|
-
updateTriggers.getPointRadius = {
|
|
10514
|
-
aggregationExpAlias,
|
|
10515
|
-
radiusRange: visConfig.radiusRange
|
|
10516
|
-
};
|
|
10517
9858
|
result.textCharacterSet = "auto";
|
|
10518
9859
|
result.textFontFamily = "Inter, sans";
|
|
10519
9860
|
result.textFontSettings = { sdf: true };
|
|
10520
9861
|
result.textFontWeight = 600;
|
|
10521
9862
|
result.getText = (d) => TEXT_NUMBER_FORMATTER.format(d.properties[aggregationExpAlias]);
|
|
10522
|
-
updateTriggers.getText = aggregationExpAlias;
|
|
10523
9863
|
result.getTextColor = config2.textLabel[TEXT_LABEL_INDEX].color;
|
|
10524
9864
|
result.textOutlineColor = [
|
|
10525
9865
|
...config2.textLabel[TEXT_LABEL_INDEX].outlineColor,
|
|
@@ -10536,107 +9876,68 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10536
9876
|
);
|
|
10537
9877
|
return calculateClusterTextFontSize(radius);
|
|
10538
9878
|
};
|
|
10539
|
-
updateTriggers.getTextSize = {
|
|
10540
|
-
aggregationExpAlias,
|
|
10541
|
-
radiusRange: visConfig.radiusRange
|
|
10542
|
-
};
|
|
10543
|
-
}
|
|
10544
|
-
{
|
|
10545
|
-
const radiusRange = visConfig.radiusRange;
|
|
10546
|
-
const { radiusField, radiusScale } = visualChannels;
|
|
10547
|
-
if (radiusField && radiusRange && radiusScale) {
|
|
10548
|
-
const { accessor, ...scaleProps } = getSizeAccessor(
|
|
10549
|
-
radiusField,
|
|
10550
|
-
radiusScale,
|
|
10551
|
-
visConfig.sizeAggregation,
|
|
10552
|
-
radiusRange,
|
|
10553
|
-
data
|
|
10554
|
-
);
|
|
10555
|
-
result.getPointRadius = accessor;
|
|
10556
|
-
scales.pointRadius = updateTriggers.getPointRadius = {
|
|
10557
|
-
field: radiusField,
|
|
10558
|
-
type: radiusScale,
|
|
10559
|
-
...scaleProps
|
|
10560
|
-
};
|
|
10561
|
-
}
|
|
10562
9879
|
}
|
|
10563
|
-
{
|
|
10564
|
-
const
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
)
|
|
10576
|
-
|
|
10577
|
-
scales.lineColor = updateTriggers.getLineColor = {
|
|
10578
|
-
field: strokeColorField,
|
|
10579
|
-
type: strokeColorScale,
|
|
10580
|
-
...scaleProps
|
|
10581
|
-
};
|
|
10582
|
-
}
|
|
9880
|
+
if (radiusField) {
|
|
9881
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9882
|
+
radiusField,
|
|
9883
|
+
radiusScale,
|
|
9884
|
+
visConfig.sizeAggregation,
|
|
9885
|
+
visConfig.radiusRange || visConfig.sizeRange,
|
|
9886
|
+
data
|
|
9887
|
+
);
|
|
9888
|
+
result.getPointRadius = accessor;
|
|
9889
|
+
scales.pointRadius = {
|
|
9890
|
+
field: radiusField,
|
|
9891
|
+
type: radiusScale || "identity",
|
|
9892
|
+
...domainAndRangeFromScale(scale2)
|
|
9893
|
+
};
|
|
10583
9894
|
}
|
|
10584
|
-
{
|
|
10585
|
-
const
|
|
10586
|
-
const {
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
};
|
|
10601
|
-
}
|
|
9895
|
+
if (strokeColorField) {
|
|
9896
|
+
const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : 1;
|
|
9897
|
+
const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
|
|
9898
|
+
const { accessor, scale: scale2 } = getColorAccessor(
|
|
9899
|
+
strokeColorField,
|
|
9900
|
+
strokeColorScale,
|
|
9901
|
+
{ aggregation, range },
|
|
9902
|
+
opacity,
|
|
9903
|
+
data
|
|
9904
|
+
);
|
|
9905
|
+
result.getLineColor = accessor;
|
|
9906
|
+
scales.lineColor = {
|
|
9907
|
+
field: strokeColorField,
|
|
9908
|
+
type: strokeColorScale,
|
|
9909
|
+
...domainAndRangeFromScale(scale2)
|
|
9910
|
+
};
|
|
10602
9911
|
}
|
|
10603
|
-
{
|
|
10604
|
-
const {
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
type: heightScale || "identity",
|
|
10618
|
-
...scaleProps
|
|
10619
|
-
};
|
|
10620
|
-
}
|
|
9912
|
+
if (heightField && visConfig.enable3d) {
|
|
9913
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9914
|
+
heightField,
|
|
9915
|
+
heightScale,
|
|
9916
|
+
visConfig.heightAggregation,
|
|
9917
|
+
visConfig.heightRange || visConfig.sizeRange,
|
|
9918
|
+
data
|
|
9919
|
+
);
|
|
9920
|
+
result.getElevation = accessor;
|
|
9921
|
+
scales.elevation = {
|
|
9922
|
+
field: heightField,
|
|
9923
|
+
type: heightScale || "identity",
|
|
9924
|
+
...domainAndRangeFromScale(scale2)
|
|
9925
|
+
};
|
|
10621
9926
|
}
|
|
10622
|
-
{
|
|
10623
|
-
const {
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
type: "identity",
|
|
10637
|
-
...scaleProps
|
|
10638
|
-
};
|
|
10639
|
-
}
|
|
9927
|
+
if (weightField) {
|
|
9928
|
+
const { accessor, scale: scale2 } = getSizeAccessor(
|
|
9929
|
+
weightField,
|
|
9930
|
+
void 0,
|
|
9931
|
+
visConfig.weightAggregation,
|
|
9932
|
+
void 0,
|
|
9933
|
+
data
|
|
9934
|
+
);
|
|
9935
|
+
result.getWeight = accessor;
|
|
9936
|
+
scales.weight = {
|
|
9937
|
+
field: weightField,
|
|
9938
|
+
type: "identity",
|
|
9939
|
+
...domainAndRangeFromScale(scale2)
|
|
9940
|
+
};
|
|
10640
9941
|
}
|
|
10641
9942
|
if (visConfig.customMarkers) {
|
|
10642
9943
|
const maxIconSize = getMaxMarkerSize(visConfig, visualChannels);
|
|
@@ -10653,12 +9954,6 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10653
9954
|
{ fallbackUrl: customMarkersUrl, maxIconSize, useMaskedIcons },
|
|
10654
9955
|
data
|
|
10655
9956
|
);
|
|
10656
|
-
updateTriggers.getIcon = {
|
|
10657
|
-
customMarkersUrl,
|
|
10658
|
-
customMarkersRange,
|
|
10659
|
-
maxIconSize,
|
|
10660
|
-
useMaskedIcons
|
|
10661
|
-
};
|
|
10662
9957
|
result._subLayerProps = {
|
|
10663
9958
|
"points-icon": {
|
|
10664
9959
|
loadOptions: {
|
|
@@ -10675,11 +9970,9 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10675
9970
|
};
|
|
10676
9971
|
if (getFillColor && useMaskedIcons) {
|
|
10677
9972
|
result.getIconColor = getFillColor;
|
|
10678
|
-
updateTriggers.getIconColor = updateTriggers.getFillColor;
|
|
10679
9973
|
}
|
|
10680
9974
|
if (getPointRadius) {
|
|
10681
9975
|
result.getIconSize = getPointRadius;
|
|
10682
|
-
updateTriggers.getIconSize = updateTriggers.getPointRadius;
|
|
10683
9976
|
}
|
|
10684
9977
|
if (visualChannels.rotationField) {
|
|
10685
9978
|
const { accessor } = getSizeAccessor(
|
|
@@ -10690,7 +9983,6 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10690
9983
|
data
|
|
10691
9984
|
);
|
|
10692
9985
|
result.getIconAngle = negateAccessor(accessor);
|
|
10693
|
-
updateTriggers.getIconAngle = updateTriggers.getRotationField;
|
|
10694
9986
|
}
|
|
10695
9987
|
} else if (layerType === "tileset") {
|
|
10696
9988
|
result.pointType = "circle";
|
|
@@ -10735,13 +10027,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10735
10027
|
}
|
|
10736
10028
|
};
|
|
10737
10029
|
}
|
|
10738
|
-
return {
|
|
10739
|
-
channelProps: {
|
|
10740
|
-
...result,
|
|
10741
|
-
updateTriggers
|
|
10742
|
-
},
|
|
10743
|
-
scales
|
|
10744
|
-
};
|
|
10030
|
+
return { channelProps: result, scales };
|
|
10745
10031
|
}
|
|
10746
10032
|
function createLoadOptions(accessToken) {
|
|
10747
10033
|
return {
|
|
@@ -11397,16 +10683,9 @@ function hashBuckets(initialCount) {
|
|
|
11397
10683
|
WidgetSource,
|
|
11398
10684
|
WidgetTableSource,
|
|
11399
10685
|
WidgetTilesetSource,
|
|
11400
|
-
_ErrorCode,
|
|
11401
|
-
_applyLayerGroupFilters,
|
|
11402
10686
|
_buildFeatureFilter,
|
|
11403
|
-
_createVecExprEvaluator,
|
|
11404
10687
|
_domainFromValues,
|
|
11405
|
-
_evaluateVecExpr,
|
|
11406
10688
|
_getHexagonResolution,
|
|
11407
|
-
_getLog10ScaleSteps,
|
|
11408
|
-
_getRasterTileLayerStyleProps,
|
|
11409
|
-
_validateVecExprSyntax,
|
|
11410
10689
|
addFilter,
|
|
11411
10690
|
aggregate,
|
|
11412
10691
|
aggregationFunctions,
|
|
@@ -11419,11 +10698,9 @@ function hashBuckets(initialCount) {
|
|
|
11419
10698
|
buildStatsUrl,
|
|
11420
10699
|
calculateClusterRadius,
|
|
11421
10700
|
calculateClusterTextFontSize,
|
|
11422
|
-
calculateLayerScale,
|
|
11423
10701
|
clearDefaultRequestCache,
|
|
11424
10702
|
clearFilters,
|
|
11425
10703
|
configureSource,
|
|
11426
|
-
createColorScale,
|
|
11427
10704
|
createPolygonSpatialFilter,
|
|
11428
10705
|
createViewportSpatialFilter,
|
|
11429
10706
|
fetchBasemapProps,
|
|
@@ -11438,7 +10715,6 @@ function hashBuckets(initialCount) {
|
|
|
11438
10715
|
getDefaultAggregationExpColumnAliasForLayerType,
|
|
11439
10716
|
getFilter,
|
|
11440
10717
|
getIconUrlAccessor,
|
|
11441
|
-
getLayerDescriptor,
|
|
11442
10718
|
getLayerProps,
|
|
11443
10719
|
getMaxMarkerSize,
|
|
11444
10720
|
getSizeAccessor,
|
|
@@ -11469,6 +10745,8 @@ function hashBuckets(initialCount) {
|
|
|
11469
10745
|
tileFeatures,
|
|
11470
10746
|
tileFeaturesGeometries,
|
|
11471
10747
|
tileFeaturesSpatialIndex,
|
|
10748
|
+
trajectoryQuerySource,
|
|
10749
|
+
trajectoryTableSource,
|
|
11472
10750
|
transformToTileCoords,
|
|
11473
10751
|
vectorQuerySource,
|
|
11474
10752
|
vectorTableSource,
|