@carto/api-client 0.5.20 → 0.5.22-0.alpha.raster-scales.0
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 +39 -24
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +8 -2
- package/build/api-client.d.ts +8 -2
- package/build/api-client.js +39 -24
- package/build/api-client.js.map +1 -1
- package/package.json +3 -2
- package/src/api/query.ts +5 -2
- package/src/fetch-map/fetch-map.ts +2 -2
- package/src/fetch-map/parse-map.ts +19 -7
- package/src/fetch-map/raster-layer.ts +20 -14
- package/src/fetch-map/types.ts +1 -0
package/CHANGELOG.md
CHANGED
package/build/api-client.cjs
CHANGED
|
@@ -8695,7 +8695,7 @@ var query = async function(options) {
|
|
|
8695
8695
|
} = options;
|
|
8696
8696
|
const urlParameters = { q: sqlQuery };
|
|
8697
8697
|
if (queryParameters) {
|
|
8698
|
-
urlParameters.queryParameters =
|
|
8698
|
+
urlParameters.queryParameters = queryParameters;
|
|
8699
8699
|
}
|
|
8700
8700
|
const baseUrl = buildQueryUrl({ apiBaseUrl, connectionName });
|
|
8701
8701
|
const headers = {
|
|
@@ -10372,19 +10372,8 @@ function domainFromRasterMetadataBand(band, scaleType, colorRange) {
|
|
|
10372
10372
|
if (scaleType === "ordinal") {
|
|
10373
10373
|
return colorRange.colorMap?.map(([value]) => value) || [];
|
|
10374
10374
|
}
|
|
10375
|
-
if (scaleType === "custom") {
|
|
10376
|
-
if (colorRange.uiCustomScaleType === "logarithmic") {
|
|
10377
|
-
return getLog10ScaleSteps({
|
|
10378
|
-
min: band.stats.min,
|
|
10379
|
-
max: band.stats.max,
|
|
10380
|
-
steps: colorRange.colors.length
|
|
10381
|
-
});
|
|
10382
|
-
} else {
|
|
10383
|
-
return colorRange.colorMap?.map(([value]) => value) || [];
|
|
10384
|
-
}
|
|
10385
|
-
}
|
|
10386
|
-
const scaleLength = colorRange.colors.length;
|
|
10387
10375
|
if (scaleType === "quantile") {
|
|
10376
|
+
const scaleLength = colorRange.colors.length;
|
|
10388
10377
|
const quantiles = band.stats.quantiles?.[scaleLength];
|
|
10389
10378
|
if (!quantiles) {
|
|
10390
10379
|
return [0, 1];
|
|
@@ -10410,9 +10399,21 @@ function getRasterTileLayerStylePropsScaledBand({
|
|
|
10410
10399
|
return {};
|
|
10411
10400
|
}
|
|
10412
10401
|
const domain = domainFromRasterMetadataBand(bandInfo, scaleType, colorRange);
|
|
10402
|
+
let scaleDomain = domain;
|
|
10403
|
+
if (scaleType === "custom") {
|
|
10404
|
+
if (colorRange.uiCustomScaleType === "logarithmic") {
|
|
10405
|
+
scaleDomain = getLog10ScaleSteps({
|
|
10406
|
+
min: bandInfo.stats.min,
|
|
10407
|
+
max: bandInfo.stats.max,
|
|
10408
|
+
steps: colorRange.colors.length
|
|
10409
|
+
});
|
|
10410
|
+
} else {
|
|
10411
|
+
scaleDomain = colorRange.colorMap?.map(([value]) => value) || [];
|
|
10412
|
+
}
|
|
10413
|
+
}
|
|
10413
10414
|
const scaleFun = createColorScale(
|
|
10414
10415
|
scaleType,
|
|
10415
|
-
|
|
10416
|
+
scaleDomain,
|
|
10416
10417
|
colorRange.colors.map(hexToRGB2),
|
|
10417
10418
|
UNKNOWN_COLOR2
|
|
10418
10419
|
);
|
|
@@ -10427,7 +10428,12 @@ function getRasterTileLayerStylePropsScaledBand({
|
|
|
10427
10428
|
updateTriggers: getRasterTileLayerUpdateTriggers({
|
|
10428
10429
|
layerConfig,
|
|
10429
10430
|
visualChannels
|
|
10430
|
-
})
|
|
10431
|
+
}),
|
|
10432
|
+
domain,
|
|
10433
|
+
scaleDomain: scaleFun.domain(),
|
|
10434
|
+
range: colorRange.colors,
|
|
10435
|
+
type: scaleType,
|
|
10436
|
+
field: colorField
|
|
10431
10437
|
};
|
|
10432
10438
|
}
|
|
10433
10439
|
function getRasterTileLayerStyleProps({
|
|
@@ -10643,18 +10649,27 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
10643
10649
|
rasterMetadata,
|
|
10644
10650
|
visualChannels
|
|
10645
10651
|
}),
|
|
10646
|
-
scales: {
|
|
10647
|
-
|
|
10652
|
+
scales: {
|
|
10653
|
+
fillColor: {
|
|
10654
|
+
type: "identity"
|
|
10655
|
+
}
|
|
10656
|
+
}
|
|
10648
10657
|
};
|
|
10649
10658
|
} else {
|
|
10659
|
+
const { dataTransform, updateTriggers: updateTriggers2, ...scaleProps } = getRasterTileLayerStylePropsScaledBand({
|
|
10660
|
+
layerConfig: config2,
|
|
10661
|
+
visualChannels,
|
|
10662
|
+
rasterMetadata
|
|
10663
|
+
});
|
|
10650
10664
|
return {
|
|
10651
|
-
channelProps:
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
}),
|
|
10665
|
+
channelProps: {
|
|
10666
|
+
dataTransform,
|
|
10667
|
+
updateTriggers: updateTriggers2
|
|
10668
|
+
},
|
|
10656
10669
|
scales: {
|
|
10657
|
-
|
|
10670
|
+
...scaleProps.type && {
|
|
10671
|
+
fillColor: scaleProps
|
|
10672
|
+
}
|
|
10658
10673
|
}
|
|
10659
10674
|
};
|
|
10660
10675
|
}
|
|
@@ -11218,7 +11233,7 @@ async function _fetchTilestats(attribute, dataset, context) {
|
|
|
11218
11233
|
if (type === "query") {
|
|
11219
11234
|
parameters.q = source;
|
|
11220
11235
|
if (queryParameters) {
|
|
11221
|
-
parameters.queryParameters =
|
|
11236
|
+
parameters.queryParameters = queryParameters;
|
|
11222
11237
|
}
|
|
11223
11238
|
}
|
|
11224
11239
|
const stats = await requestWithParameters({
|