@carto/api-client 0.5.19-alpha.radius-aggregation-1 → 0.5.20
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 +9 -2
- package/build/api-client.cjs +157 -129
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +77 -60
- package/build/api-client.d.ts +77 -60
- package/build/api-client.js +149 -124
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/layer-map.ts +13 -3
- package/src/sources/index.ts +47 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
- fix(fetchMap): support point radius aggregation (#241)
|
|
6
|
-
|
|
7
5
|
## 0.5
|
|
8
6
|
|
|
7
|
+
### 0.5.20
|
|
8
|
+
|
|
9
|
+
- fix(fetchMap): support quantile color scale with 2 ranges (#241)
|
|
10
|
+
|
|
11
|
+
### 0.5.19
|
|
12
|
+
|
|
13
|
+
- fix(fetchMap): support point radius aggregation (#242)
|
|
14
|
+
- fix(sources): export CARTO_SOURCES (#243)
|
|
15
|
+
|
|
9
16
|
### 0.5.18
|
|
10
17
|
|
|
11
18
|
- fix(fetchMap): getColorAccessor treats colorMap as override of actual domain (#238)
|
package/build/api-client.cjs
CHANGED
|
@@ -102,6 +102,7 @@ __export(src_exports, {
|
|
|
102
102
|
AggregationTypes: () => AggregationTypes,
|
|
103
103
|
ApiVersion: () => ApiVersion,
|
|
104
104
|
BASEMAP: () => basemap_styles_default,
|
|
105
|
+
CARTO_SOURCES: () => CARTO_SOURCES,
|
|
105
106
|
CartoAPIError: () => CartoAPIError,
|
|
106
107
|
CellSet: () => CellSet,
|
|
107
108
|
DEFAULT_API_BASE_URL: () => DEFAULT_API_BASE_URL,
|
|
@@ -6081,6 +6082,9 @@ init_cjs_shims();
|
|
|
6081
6082
|
// src/sources/index.ts
|
|
6082
6083
|
init_cjs_shims();
|
|
6083
6084
|
|
|
6085
|
+
// src/sources/boundary-query-source.ts
|
|
6086
|
+
init_cjs_shims();
|
|
6087
|
+
|
|
6084
6088
|
// src/sources/base-source.ts
|
|
6085
6089
|
init_cjs_shims();
|
|
6086
6090
|
|
|
@@ -6264,20 +6268,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
6264
6268
|
return json;
|
|
6265
6269
|
}
|
|
6266
6270
|
|
|
6267
|
-
// src/sources/constants.ts
|
|
6268
|
-
init_cjs_shims();
|
|
6269
|
-
var RasterBandColorinterp = /* @__PURE__ */ ((RasterBandColorinterp2) => {
|
|
6270
|
-
RasterBandColorinterp2["Gray"] = "gray";
|
|
6271
|
-
RasterBandColorinterp2["Red"] = "red";
|
|
6272
|
-
RasterBandColorinterp2["Green"] = "green";
|
|
6273
|
-
RasterBandColorinterp2["Blue"] = "blue";
|
|
6274
|
-
RasterBandColorinterp2["Alpha"] = "alpha";
|
|
6275
|
-
RasterBandColorinterp2["Palette"] = "palette";
|
|
6276
|
-
return RasterBandColorinterp2;
|
|
6277
|
-
})(RasterBandColorinterp || {});
|
|
6278
|
-
|
|
6279
6271
|
// src/sources/boundary-query-source.ts
|
|
6280
|
-
init_cjs_shims();
|
|
6281
6272
|
var boundaryQuerySource = async function(options) {
|
|
6282
6273
|
const {
|
|
6283
6274
|
columns,
|
|
@@ -8331,29 +8322,6 @@ var h3TilesetSource = async function(options) {
|
|
|
8331
8322
|
);
|
|
8332
8323
|
};
|
|
8333
8324
|
|
|
8334
|
-
// src/sources/raster-source.ts
|
|
8335
|
-
init_cjs_shims();
|
|
8336
|
-
var rasterSource = async function(options) {
|
|
8337
|
-
const { tableName, filters } = options;
|
|
8338
|
-
const urlParameters = { name: tableName };
|
|
8339
|
-
if (filters) {
|
|
8340
|
-
urlParameters.filters = filters;
|
|
8341
|
-
}
|
|
8342
|
-
return baseSource("raster", options, urlParameters).then(
|
|
8343
|
-
(result) => ({
|
|
8344
|
-
...result,
|
|
8345
|
-
widgetSource: new WidgetRasterSource({
|
|
8346
|
-
...options,
|
|
8347
|
-
tileFormat: getTileFormat(result),
|
|
8348
|
-
spatialDataColumn: "quadbin",
|
|
8349
|
-
spatialDataType: "quadbin",
|
|
8350
|
-
spatialDataBounds: result.bounds,
|
|
8351
|
-
rasterMetadata: result.raster_metadata
|
|
8352
|
-
})
|
|
8353
|
-
})
|
|
8354
|
-
);
|
|
8355
|
-
};
|
|
8356
|
-
|
|
8357
8325
|
// src/sources/quadbin-query-source.ts
|
|
8358
8326
|
init_cjs_shims();
|
|
8359
8327
|
var quadbinQuerySource = async function(options) {
|
|
@@ -8457,106 +8425,24 @@ var quadbinTilesetSource = async function(options) {
|
|
|
8457
8425
|
);
|
|
8458
8426
|
};
|
|
8459
8427
|
|
|
8460
|
-
// src/sources/
|
|
8461
|
-
init_cjs_shims();
|
|
8462
|
-
var vectorQuerySource = async function(options) {
|
|
8463
|
-
const {
|
|
8464
|
-
columns,
|
|
8465
|
-
filters,
|
|
8466
|
-
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8467
|
-
sqlQuery,
|
|
8468
|
-
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8469
|
-
queryParameters,
|
|
8470
|
-
aggregationExp
|
|
8471
|
-
} = options;
|
|
8472
|
-
const spatialDataType = "geo";
|
|
8473
|
-
const urlParameters = {
|
|
8474
|
-
spatialDataColumn,
|
|
8475
|
-
spatialDataType,
|
|
8476
|
-
tileResolution: tileResolution.toString(),
|
|
8477
|
-
q: sqlQuery
|
|
8478
|
-
};
|
|
8479
|
-
if (columns) {
|
|
8480
|
-
urlParameters.columns = columns.join(",");
|
|
8481
|
-
}
|
|
8482
|
-
if (filters) {
|
|
8483
|
-
urlParameters.filters = filters;
|
|
8484
|
-
}
|
|
8485
|
-
if (queryParameters) {
|
|
8486
|
-
urlParameters.queryParameters = queryParameters;
|
|
8487
|
-
}
|
|
8488
|
-
if (aggregationExp) {
|
|
8489
|
-
urlParameters.aggregationExp = aggregationExp;
|
|
8490
|
-
}
|
|
8491
|
-
return baseSource("query", options, urlParameters).then(
|
|
8492
|
-
(result) => ({
|
|
8493
|
-
...result,
|
|
8494
|
-
widgetSource: new WidgetQuerySource({
|
|
8495
|
-
...options,
|
|
8496
|
-
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8497
|
-
spatialDataColumn,
|
|
8498
|
-
spatialDataType,
|
|
8499
|
-
tileResolution
|
|
8500
|
-
})
|
|
8501
|
-
})
|
|
8502
|
-
);
|
|
8503
|
-
};
|
|
8504
|
-
|
|
8505
|
-
// src/sources/vector-table-source.ts
|
|
8428
|
+
// src/sources/raster-source.ts
|
|
8506
8429
|
init_cjs_shims();
|
|
8507
|
-
var
|
|
8508
|
-
const {
|
|
8509
|
-
|
|
8510
|
-
filters,
|
|
8511
|
-
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8512
|
-
tableName,
|
|
8513
|
-
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8514
|
-
aggregationExp
|
|
8515
|
-
} = options;
|
|
8516
|
-
const spatialDataType = "geo";
|
|
8517
|
-
const urlParameters = {
|
|
8518
|
-
name: tableName,
|
|
8519
|
-
spatialDataColumn,
|
|
8520
|
-
spatialDataType,
|
|
8521
|
-
tileResolution: tileResolution.toString()
|
|
8522
|
-
};
|
|
8523
|
-
if (columns) {
|
|
8524
|
-
urlParameters.columns = columns.join(",");
|
|
8525
|
-
}
|
|
8430
|
+
var rasterSource = async function(options) {
|
|
8431
|
+
const { tableName, filters } = options;
|
|
8432
|
+
const urlParameters = { name: tableName };
|
|
8526
8433
|
if (filters) {
|
|
8527
8434
|
urlParameters.filters = filters;
|
|
8528
8435
|
}
|
|
8529
|
-
|
|
8530
|
-
urlParameters.aggregationExp = aggregationExp;
|
|
8531
|
-
}
|
|
8532
|
-
return baseSource("table", options, urlParameters).then(
|
|
8533
|
-
(result) => ({
|
|
8534
|
-
...result,
|
|
8535
|
-
widgetSource: new WidgetTableSource({
|
|
8536
|
-
...options,
|
|
8537
|
-
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8538
|
-
spatialDataColumn,
|
|
8539
|
-
spatialDataType,
|
|
8540
|
-
tileResolution
|
|
8541
|
-
})
|
|
8542
|
-
})
|
|
8543
|
-
);
|
|
8544
|
-
};
|
|
8545
|
-
|
|
8546
|
-
// src/sources/vector-tileset-source.ts
|
|
8547
|
-
init_cjs_shims();
|
|
8548
|
-
var vectorTilesetSource = async function(options) {
|
|
8549
|
-
const { tableName, spatialDataColumn = DEFAULT_GEO_COLUMN } = options;
|
|
8550
|
-
const urlParameters = { name: tableName };
|
|
8551
|
-
return baseSource("tileset", options, urlParameters).then(
|
|
8436
|
+
return baseSource("raster", options, urlParameters).then(
|
|
8552
8437
|
(result) => ({
|
|
8553
8438
|
...result,
|
|
8554
|
-
widgetSource: new
|
|
8439
|
+
widgetSource: new WidgetRasterSource({
|
|
8555
8440
|
...options,
|
|
8556
8441
|
tileFormat: getTileFormat(result),
|
|
8557
|
-
spatialDataColumn,
|
|
8558
|
-
spatialDataType: "
|
|
8559
|
-
spatialDataBounds: result.bounds
|
|
8442
|
+
spatialDataColumn: "quadbin",
|
|
8443
|
+
spatialDataType: "quadbin",
|
|
8444
|
+
spatialDataBounds: result.bounds,
|
|
8445
|
+
rasterMetadata: result.raster_metadata
|
|
8560
8446
|
})
|
|
8561
8447
|
})
|
|
8562
8448
|
);
|
|
@@ -8660,6 +8546,141 @@ var trajectoryTableSource = async function(options) {
|
|
|
8660
8546
|
};
|
|
8661
8547
|
};
|
|
8662
8548
|
|
|
8549
|
+
// src/sources/vector-query-source.ts
|
|
8550
|
+
init_cjs_shims();
|
|
8551
|
+
var vectorQuerySource = async function(options) {
|
|
8552
|
+
const {
|
|
8553
|
+
columns,
|
|
8554
|
+
filters,
|
|
8555
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8556
|
+
sqlQuery,
|
|
8557
|
+
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8558
|
+
queryParameters,
|
|
8559
|
+
aggregationExp
|
|
8560
|
+
} = options;
|
|
8561
|
+
const spatialDataType = "geo";
|
|
8562
|
+
const urlParameters = {
|
|
8563
|
+
spatialDataColumn,
|
|
8564
|
+
spatialDataType,
|
|
8565
|
+
tileResolution: tileResolution.toString(),
|
|
8566
|
+
q: sqlQuery
|
|
8567
|
+
};
|
|
8568
|
+
if (columns) {
|
|
8569
|
+
urlParameters.columns = columns.join(",");
|
|
8570
|
+
}
|
|
8571
|
+
if (filters) {
|
|
8572
|
+
urlParameters.filters = filters;
|
|
8573
|
+
}
|
|
8574
|
+
if (queryParameters) {
|
|
8575
|
+
urlParameters.queryParameters = queryParameters;
|
|
8576
|
+
}
|
|
8577
|
+
if (aggregationExp) {
|
|
8578
|
+
urlParameters.aggregationExp = aggregationExp;
|
|
8579
|
+
}
|
|
8580
|
+
return baseSource("query", options, urlParameters).then(
|
|
8581
|
+
(result) => ({
|
|
8582
|
+
...result,
|
|
8583
|
+
widgetSource: new WidgetQuerySource({
|
|
8584
|
+
...options,
|
|
8585
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8586
|
+
spatialDataColumn,
|
|
8587
|
+
spatialDataType,
|
|
8588
|
+
tileResolution
|
|
8589
|
+
})
|
|
8590
|
+
})
|
|
8591
|
+
);
|
|
8592
|
+
};
|
|
8593
|
+
|
|
8594
|
+
// src/sources/vector-table-source.ts
|
|
8595
|
+
init_cjs_shims();
|
|
8596
|
+
var vectorTableSource = async function(options) {
|
|
8597
|
+
const {
|
|
8598
|
+
columns,
|
|
8599
|
+
filters,
|
|
8600
|
+
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
8601
|
+
tableName,
|
|
8602
|
+
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
8603
|
+
aggregationExp
|
|
8604
|
+
} = options;
|
|
8605
|
+
const spatialDataType = "geo";
|
|
8606
|
+
const urlParameters = {
|
|
8607
|
+
name: tableName,
|
|
8608
|
+
spatialDataColumn,
|
|
8609
|
+
spatialDataType,
|
|
8610
|
+
tileResolution: tileResolution.toString()
|
|
8611
|
+
};
|
|
8612
|
+
if (columns) {
|
|
8613
|
+
urlParameters.columns = columns.join(",");
|
|
8614
|
+
}
|
|
8615
|
+
if (filters) {
|
|
8616
|
+
urlParameters.filters = filters;
|
|
8617
|
+
}
|
|
8618
|
+
if (aggregationExp) {
|
|
8619
|
+
urlParameters.aggregationExp = aggregationExp;
|
|
8620
|
+
}
|
|
8621
|
+
return baseSource("table", options, urlParameters).then(
|
|
8622
|
+
(result) => ({
|
|
8623
|
+
...result,
|
|
8624
|
+
widgetSource: new WidgetTableSource({
|
|
8625
|
+
...options,
|
|
8626
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
8627
|
+
spatialDataColumn,
|
|
8628
|
+
spatialDataType,
|
|
8629
|
+
tileResolution
|
|
8630
|
+
})
|
|
8631
|
+
})
|
|
8632
|
+
);
|
|
8633
|
+
};
|
|
8634
|
+
|
|
8635
|
+
// src/sources/vector-tileset-source.ts
|
|
8636
|
+
init_cjs_shims();
|
|
8637
|
+
var vectorTilesetSource = async function(options) {
|
|
8638
|
+
const { tableName, spatialDataColumn = DEFAULT_GEO_COLUMN } = options;
|
|
8639
|
+
const urlParameters = { name: tableName };
|
|
8640
|
+
return baseSource("tileset", options, urlParameters).then(
|
|
8641
|
+
(result) => ({
|
|
8642
|
+
...result,
|
|
8643
|
+
widgetSource: new WidgetTilesetSource({
|
|
8644
|
+
...options,
|
|
8645
|
+
tileFormat: getTileFormat(result),
|
|
8646
|
+
spatialDataColumn,
|
|
8647
|
+
spatialDataType: "geo",
|
|
8648
|
+
spatialDataBounds: result.bounds
|
|
8649
|
+
})
|
|
8650
|
+
})
|
|
8651
|
+
);
|
|
8652
|
+
};
|
|
8653
|
+
|
|
8654
|
+
// src/sources/constants.ts
|
|
8655
|
+
init_cjs_shims();
|
|
8656
|
+
var RasterBandColorinterp = /* @__PURE__ */ ((RasterBandColorinterp2) => {
|
|
8657
|
+
RasterBandColorinterp2["Gray"] = "gray";
|
|
8658
|
+
RasterBandColorinterp2["Red"] = "red";
|
|
8659
|
+
RasterBandColorinterp2["Green"] = "green";
|
|
8660
|
+
RasterBandColorinterp2["Blue"] = "blue";
|
|
8661
|
+
RasterBandColorinterp2["Alpha"] = "alpha";
|
|
8662
|
+
RasterBandColorinterp2["Palette"] = "palette";
|
|
8663
|
+
return RasterBandColorinterp2;
|
|
8664
|
+
})(RasterBandColorinterp || {});
|
|
8665
|
+
|
|
8666
|
+
// src/sources/index.ts
|
|
8667
|
+
var CARTO_SOURCES = {
|
|
8668
|
+
boundaryQuerySource,
|
|
8669
|
+
boundaryTableSource,
|
|
8670
|
+
h3QuerySource,
|
|
8671
|
+
h3TableSource,
|
|
8672
|
+
h3TilesetSource,
|
|
8673
|
+
quadbinQuerySource,
|
|
8674
|
+
quadbinTableSource,
|
|
8675
|
+
quadbinTilesetSource,
|
|
8676
|
+
rasterSource,
|
|
8677
|
+
trajectoryQuerySource,
|
|
8678
|
+
trajectoryTableSource,
|
|
8679
|
+
vectorQuerySource,
|
|
8680
|
+
vectorTableSource,
|
|
8681
|
+
vectorTilesetSource
|
|
8682
|
+
};
|
|
8683
|
+
|
|
8663
8684
|
// src/api/query.ts
|
|
8664
8685
|
var query = async function(options) {
|
|
8665
8686
|
const {
|
|
@@ -9836,7 +9857,13 @@ function domainFromAttribute(attribute, scaleType, scaleLength) {
|
|
|
9836
9857
|
return attribute.categories.map((c) => c.category).filter((c) => c !== void 0 && c !== null);
|
|
9837
9858
|
}
|
|
9838
9859
|
if (scaleType === "quantile" && attribute.quantiles) {
|
|
9839
|
-
|
|
9860
|
+
const quantiles = "global" in attribute.quantiles ? attribute.quantiles.global : attribute.quantiles;
|
|
9861
|
+
if (scaleLength === 2 && !quantiles[2] && quantiles[4]?.length === 5) {
|
|
9862
|
+
return [quantiles[4][0], quantiles[4][2], quantiles[4][4]];
|
|
9863
|
+
}
|
|
9864
|
+
if (quantiles[scaleLength]) {
|
|
9865
|
+
return quantiles[scaleLength];
|
|
9866
|
+
}
|
|
9840
9867
|
}
|
|
9841
9868
|
let { min: min2 } = attribute;
|
|
9842
9869
|
if (scaleType === "log" && min2 === 0) {
|
|
@@ -11541,6 +11568,7 @@ function hashBuckets(initialCount) {
|
|
|
11541
11568
|
AggregationTypes,
|
|
11542
11569
|
ApiVersion,
|
|
11543
11570
|
BASEMAP,
|
|
11571
|
+
CARTO_SOURCES,
|
|
11544
11572
|
CartoAPIError,
|
|
11545
11573
|
CellSet,
|
|
11546
11574
|
DEFAULT_API_BASE_URL,
|