@carto/api-client 0.5.3 → 0.5.4-alpha.1

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.
@@ -1446,7 +1446,7 @@ type TileFeatures = {
1446
1446
  spatialFilter: SpatialFilter;
1447
1447
  uniqueIdProperty?: string;
1448
1448
  rasterMetadata?: RasterMetadata;
1449
- options?: TileFeatureExtractOptions;
1449
+ storeGeometry?: boolean;
1450
1450
  };
1451
1451
  /** @privateRemarks Source: @carto/react-core */
1452
1452
  type TileFeatureExtractOptions = {
@@ -1456,17 +1456,18 @@ type TileFeatureExtractOptions = {
1456
1456
  uniqueIdProperty?: string;
1457
1457
  };
1458
1458
  /** @privateRemarks Source: @carto/react-core */
1459
- declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, rasterMetadata, options, }: TileFeatures): FeatureData[];
1459
+ declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, rasterMetadata, storeGeometry, }: TileFeatures): FeatureData[];
1460
1460
 
1461
1461
  declare const FEATURE_GEOM_PROPERTY = "__geomValue";
1462
+ type GeometryExtractOptions = {
1463
+ storeGeometry?: boolean;
1464
+ };
1462
1465
  declare function tileFeaturesGeometries({ tiles, tileFormat, spatialFilter, uniqueIdProperty, options, }: {
1463
1466
  tiles: Tile[];
1464
1467
  tileFormat?: TileFormat;
1465
1468
  spatialFilter: SpatialFilter;
1466
1469
  uniqueIdProperty?: string;
1467
- options?: {
1468
- storeGeometry?: boolean;
1469
- };
1470
+ options?: GeometryExtractOptions;
1470
1471
  }): FeatureData[];
1471
1472
 
1472
1473
  type TileFeaturesSpatialIndexOptions = {
@@ -1446,7 +1446,7 @@ type TileFeatures = {
1446
1446
  spatialFilter: SpatialFilter;
1447
1447
  uniqueIdProperty?: string;
1448
1448
  rasterMetadata?: RasterMetadata;
1449
- options?: TileFeatureExtractOptions;
1449
+ storeGeometry?: boolean;
1450
1450
  };
1451
1451
  /** @privateRemarks Source: @carto/react-core */
1452
1452
  type TileFeatureExtractOptions = {
@@ -1456,17 +1456,18 @@ type TileFeatureExtractOptions = {
1456
1456
  uniqueIdProperty?: string;
1457
1457
  };
1458
1458
  /** @privateRemarks Source: @carto/react-core */
1459
- declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, rasterMetadata, options, }: TileFeatures): FeatureData[];
1459
+ declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, rasterMetadata, storeGeometry, }: TileFeatures): FeatureData[];
1460
1460
 
1461
1461
  declare const FEATURE_GEOM_PROPERTY = "__geomValue";
1462
+ type GeometryExtractOptions = {
1463
+ storeGeometry?: boolean;
1464
+ };
1462
1465
  declare function tileFeaturesGeometries({ tiles, tileFormat, spatialFilter, uniqueIdProperty, options, }: {
1463
1466
  tiles: Tile[];
1464
1467
  tileFormat?: TileFormat;
1465
1468
  spatialFilter: SpatialFilter;
1466
1469
  uniqueIdProperty?: string;
1467
- options?: {
1468
- storeGeometry?: boolean;
1469
- };
1470
+ options?: GeometryExtractOptions;
1470
1471
  }): FeatureData[];
1471
1472
 
1472
1473
  type TileFeaturesSpatialIndexOptions = {
@@ -5491,6 +5491,20 @@ function isValidBandValue(value, nodata) {
5491
5491
  return Number.isNaN(value) ? false : nodata !== value;
5492
5492
  }
5493
5493
 
5494
+ // src/types.ts
5495
+ var SchemaFieldType = /* @__PURE__ */ ((SchemaFieldType2) => {
5496
+ SchemaFieldType2["Number"] = "number";
5497
+ SchemaFieldType2["Bigint"] = "bigint";
5498
+ SchemaFieldType2["String"] = "string";
5499
+ SchemaFieldType2["Geometry"] = "geometry";
5500
+ SchemaFieldType2["Timestamp"] = "timestamp";
5501
+ SchemaFieldType2["Object"] = "object";
5502
+ SchemaFieldType2["Boolean"] = "boolean";
5503
+ SchemaFieldType2["Variant"] = "variant";
5504
+ SchemaFieldType2["Unknown"] = "unknown";
5505
+ return SchemaFieldType2;
5506
+ })(SchemaFieldType || {});
5507
+
5494
5508
  // src/utils.ts
5495
5509
  var FILTER_TYPES = new Set(Object.values(FilterType));
5496
5510
  function normalizeObjectKeys(el) {
@@ -5541,6 +5555,13 @@ function assignOptional(target, ...sources) {
5541
5555
  }
5542
5556
  return target;
5543
5557
  }
5558
+ function getWidgetSpatialDataType(spatialDataType, spatialDataColumn, schema) {
5559
+ const field = schema.find((field2) => field2.name === spatialDataColumn);
5560
+ if (field && field.type === "geometry" /* Geometry */) {
5561
+ return "geo";
5562
+ }
5563
+ return spatialDataType;
5564
+ }
5544
5565
 
5545
5566
  // src/filters/tileFeatures.ts
5546
5567
  function tileFeatures({
@@ -5551,7 +5572,7 @@ function tileFeatures({
5551
5572
  spatialDataColumn = DEFAULT_GEO_COLUMN,
5552
5573
  spatialDataType,
5553
5574
  rasterMetadata,
5554
- options = {}
5575
+ storeGeometry = false
5555
5576
  }) {
5556
5577
  if (spatialDataType === "geo") {
5557
5578
  return tileFeaturesGeometries({
@@ -5559,7 +5580,7 @@ function tileFeatures({
5559
5580
  tileFormat,
5560
5581
  spatialFilter,
5561
5582
  uniqueIdProperty,
5562
- options
5583
+ options: { storeGeometry }
5563
5584
  });
5564
5585
  }
5565
5586
  if (tiles.some(isRasterTile)) {
@@ -7639,7 +7660,11 @@ var h3QuerySource = async function(options) {
7639
7660
  ...options,
7640
7661
  // NOTE: Parameters with default values above must be explicitly passed here.
7641
7662
  spatialDataColumn,
7642
- spatialDataType
7663
+ spatialDataType: getWidgetSpatialDataType(
7664
+ spatialDataType,
7665
+ spatialDataColumn,
7666
+ result.schema
7667
+ )
7643
7668
  })
7644
7669
  })
7645
7670
  );
@@ -7674,7 +7699,11 @@ var h3TableSource = async function(options) {
7674
7699
  ...options,
7675
7700
  // NOTE: Parameters with default values above must be explicitly passed here.
7676
7701
  spatialDataColumn,
7677
- spatialDataType
7702
+ spatialDataType: getWidgetSpatialDataType(
7703
+ spatialDataType,
7704
+ spatialDataColumn,
7705
+ result.schema
7706
+ )
7678
7707
  })
7679
7708
  })
7680
7709
  );
@@ -7757,7 +7786,11 @@ var quadbinQuerySource = async function(options) {
7757
7786
  ...options,
7758
7787
  // NOTE: Parameters with default values above must be explicitly passed here.
7759
7788
  spatialDataColumn,
7760
- spatialDataType
7789
+ spatialDataType: getWidgetSpatialDataType(
7790
+ spatialDataType,
7791
+ spatialDataColumn,
7792
+ result.schema
7793
+ )
7761
7794
  })
7762
7795
  })
7763
7796
  );
@@ -7792,7 +7825,11 @@ var quadbinTableSource = async function(options) {
7792
7825
  ...options,
7793
7826
  // NOTE: Parameters with default values above must be explicitly passed here.
7794
7827
  spatialDataColumn,
7795
- spatialDataType
7828
+ spatialDataType: getWidgetSpatialDataType(
7829
+ spatialDataType,
7830
+ spatialDataColumn,
7831
+ result.schema
7832
+ )
7796
7833
  })
7797
7834
  })
7798
7835
  );
@@ -10050,20 +10087,6 @@ function _isMultiPolygon(geometry) {
10050
10087
  return getType(geometry) === "MultiPolygon";
10051
10088
  }
10052
10089
 
10053
- // src/types.ts
10054
- var SchemaFieldType = /* @__PURE__ */ ((SchemaFieldType2) => {
10055
- SchemaFieldType2["Number"] = "number";
10056
- SchemaFieldType2["Bigint"] = "bigint";
10057
- SchemaFieldType2["String"] = "string";
10058
- SchemaFieldType2["Geometry"] = "geometry";
10059
- SchemaFieldType2["Timestamp"] = "timestamp";
10060
- SchemaFieldType2["Object"] = "object";
10061
- SchemaFieldType2["Boolean"] = "boolean";
10062
- SchemaFieldType2["Variant"] = "variant";
10063
- SchemaFieldType2["Unknown"] = "unknown";
10064
- return SchemaFieldType2;
10065
- })(SchemaFieldType || {});
10066
-
10067
10090
  // src/spatial-index.ts
10068
10091
  var DEFAULT_TILE_SIZE = 512;
10069
10092
  var BIAS = 2;