@carto/api-client 0.5.7-alpha.3 → 0.5.7-alpha.6
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/build/api-client.cjs +82 -40
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +22 -14
- package/build/api-client.d.ts +22 -14
- package/build/api-client.js +81 -36
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +3458 -2308
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +22 -32
- package/build/worker.js.map +1 -1
- package/package.json +2 -2
- package/src/filters/tileFeaturesRaster.ts +25 -10
- package/src/index.ts +1 -0
- package/src/operations/groupBy.ts +6 -24
- package/src/utils/CellSet.ts +90 -0
- package/src/widget-sources/index.ts +0 -1
- package/src/widget-sources/types.ts +1 -3
- package/src/widget-sources/widget-remote-source.ts +1 -3
- package/src/widget-sources/widget-tileset-source-impl.ts +0 -2
- package/src/widget-sources/constants.ts +0 -6
package/build/api-client.d.cts
CHANGED
|
@@ -1193,8 +1193,6 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
-
othersThreshold?: number;
|
|
1198
1196
|
}
|
|
1199
1197
|
/**
|
|
1200
1198
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1329,7 @@ type FormulaResponse = {
|
|
|
1331
1329
|
};
|
|
1332
1330
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1331
|
type CategoryResponse = {
|
|
1334
|
-
name: string
|
|
1332
|
+
name: string;
|
|
1335
1333
|
value: number;
|
|
1336
1334
|
}[];
|
|
1337
1335
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1613,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1613
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1614
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1615
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter,
|
|
1616
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1617
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1618
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1619
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,13 +1734,6 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1734
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1735
|
}
|
|
1738
1736
|
|
|
1739
|
-
/**
|
|
1740
|
-
* Name of the category that represents the "Others" category.
|
|
1741
|
-
*
|
|
1742
|
-
* See `WidgetSource.getCategories` for more information.
|
|
1743
|
-
*/
|
|
1744
|
-
declare const OTHERS_CATEGORY_NAME = "_carto_others";
|
|
1745
|
-
|
|
1746
1737
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1747
1738
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1748
1739
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1826,13 +1817,12 @@ type GroupByFeature = {
|
|
|
1826
1817
|
value: number;
|
|
1827
1818
|
}[];
|
|
1828
1819
|
/** @privateRemarks Source: @carto/react-core */
|
|
1829
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation,
|
|
1820
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1830
1821
|
data: FeatureData[];
|
|
1831
1822
|
valuesColumns?: string[];
|
|
1832
1823
|
joinOperation?: AggregationType;
|
|
1833
1824
|
keysColumn: string;
|
|
1834
1825
|
operation: AggregationType;
|
|
1835
|
-
othersThreshold?: number;
|
|
1836
1826
|
}): GroupByFeature | null;
|
|
1837
1827
|
|
|
1838
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1881,6 +1871,24 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1881
1871
|
*/
|
|
1882
1872
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1883
1873
|
|
|
1874
|
+
/**
|
|
1875
|
+
* Custom Set-like interface optimized for BigUint64 cell IDs. Unlike Set,
|
|
1876
|
+
* limited in most JavaScript runtimes to ~16M entries, this implementation
|
|
1877
|
+
* can support up to `n = 2^32 - 1` (4 billion) entries, with lookups in
|
|
1878
|
+
* amortized O(1) time.
|
|
1879
|
+
*/
|
|
1880
|
+
declare class CellSet {
|
|
1881
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
1882
|
+
private cells;
|
|
1883
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
1884
|
+
private cellView;
|
|
1885
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
1886
|
+
private hashTable;
|
|
1887
|
+
constructor(cells: bigint[]);
|
|
1888
|
+
has(cell: bigint): boolean;
|
|
1889
|
+
private hashLookup;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1884
1892
|
type FetchDatasetOptions = {
|
|
1885
1893
|
accessToken: string;
|
|
1886
1894
|
apiBaseUrl: string;
|
|
@@ -1913,4 +1921,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1913
1921
|
*/
|
|
1914
1922
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1915
1923
|
|
|
1916
|
-
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP,
|
|
1924
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.d.ts
CHANGED
|
@@ -1193,8 +1193,6 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
-
othersThreshold?: number;
|
|
1198
1196
|
}
|
|
1199
1197
|
/**
|
|
1200
1198
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1329,7 @@ type FormulaResponse = {
|
|
|
1331
1329
|
};
|
|
1332
1330
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1331
|
type CategoryResponse = {
|
|
1334
|
-
name: string
|
|
1332
|
+
name: string;
|
|
1335
1333
|
value: number;
|
|
1336
1334
|
}[];
|
|
1337
1335
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1613,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1613
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1614
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1615
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter,
|
|
1616
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1617
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1618
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1619
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,13 +1734,6 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1734
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1735
|
}
|
|
1738
1736
|
|
|
1739
|
-
/**
|
|
1740
|
-
* Name of the category that represents the "Others" category.
|
|
1741
|
-
*
|
|
1742
|
-
* See `WidgetSource.getCategories` for more information.
|
|
1743
|
-
*/
|
|
1744
|
-
declare const OTHERS_CATEGORY_NAME = "_carto_others";
|
|
1745
|
-
|
|
1746
1737
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1747
1738
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1748
1739
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1826,13 +1817,12 @@ type GroupByFeature = {
|
|
|
1826
1817
|
value: number;
|
|
1827
1818
|
}[];
|
|
1828
1819
|
/** @privateRemarks Source: @carto/react-core */
|
|
1829
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation,
|
|
1820
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1830
1821
|
data: FeatureData[];
|
|
1831
1822
|
valuesColumns?: string[];
|
|
1832
1823
|
joinOperation?: AggregationType;
|
|
1833
1824
|
keysColumn: string;
|
|
1834
1825
|
operation: AggregationType;
|
|
1835
|
-
othersThreshold?: number;
|
|
1836
1826
|
}): GroupByFeature | null;
|
|
1837
1827
|
|
|
1838
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1881,6 +1871,24 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1881
1871
|
*/
|
|
1882
1872
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1883
1873
|
|
|
1874
|
+
/**
|
|
1875
|
+
* Custom Set-like interface optimized for BigUint64 cell IDs. Unlike Set,
|
|
1876
|
+
* limited in most JavaScript runtimes to ~16M entries, this implementation
|
|
1877
|
+
* can support up to `n = 2^32 - 1` (4 billion) entries, with lookups in
|
|
1878
|
+
* amortized O(1) time.
|
|
1879
|
+
*/
|
|
1880
|
+
declare class CellSet {
|
|
1881
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
1882
|
+
private cells;
|
|
1883
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
1884
|
+
private cellView;
|
|
1885
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
1886
|
+
private hashTable;
|
|
1887
|
+
constructor(cells: bigint[]);
|
|
1888
|
+
has(cell: bigint): boolean;
|
|
1889
|
+
private hashLookup;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1884
1892
|
type FetchDatasetOptions = {
|
|
1885
1893
|
accessToken: string;
|
|
1886
1894
|
apiBaseUrl: string;
|
|
@@ -1913,4 +1921,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1913
1921
|
*/
|
|
1914
1922
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1915
1923
|
|
|
1916
|
-
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP,
|
|
1924
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.js
CHANGED
|
@@ -5434,6 +5434,7 @@ var DEFAULT_AGGREGATION_EXP = `1 AS ${DEFAULT_AGGREGATION_EXP_ALIAS}`;
|
|
|
5434
5434
|
// src/filters/tileFeaturesRaster.ts
|
|
5435
5435
|
import {
|
|
5436
5436
|
cellToChildren as _cellToChildren,
|
|
5437
|
+
cellToBoundary,
|
|
5437
5438
|
cellToTile,
|
|
5438
5439
|
geometryToCells as geometryToCells2,
|
|
5439
5440
|
getResolution as getResolution2
|
|
@@ -5451,15 +5452,20 @@ function tileFeaturesRaster({
|
|
|
5451
5452
|
const tileResolution = getResolution2(tiles[0].index.q);
|
|
5452
5453
|
const tileBlockSize = tiles[0].data.blockSize;
|
|
5453
5454
|
const cellResolution = tileResolution + BigInt(Math.log2(tileBlockSize));
|
|
5454
|
-
const spatialFilterCells = new Set(
|
|
5455
|
-
geometryToCells2(options.spatialFilter, cellResolution)
|
|
5456
|
-
);
|
|
5457
5455
|
const data = /* @__PURE__ */ new Map();
|
|
5458
5456
|
for (const tile of tiles) {
|
|
5459
5457
|
const parent = tile.index.q;
|
|
5460
|
-
const
|
|
5461
|
-
|
|
5462
|
-
|
|
5458
|
+
const tilePolygon = cellToBoundary(parent);
|
|
5459
|
+
const tileFilter = turf_intersect_default(
|
|
5460
|
+
featureCollection([feature(tilePolygon), feature(options.spatialFilter)])
|
|
5461
|
+
);
|
|
5462
|
+
const needsFilter = tileFilter ? !turf_boolean_within_default(tilePolygon, options.spatialFilter) : false;
|
|
5463
|
+
const tileFilterCells = needsFilter ? new Set(geometryToCells2(tileFilter.geometry, cellResolution)) : null;
|
|
5464
|
+
const tileSortedCells = cellToChildrenSorted(parent, cellResolution);
|
|
5465
|
+
for (let i = 0; i < tileSortedCells.length; i++) {
|
|
5466
|
+
if (needsFilter && !tileFilterCells.has(tileSortedCells[i])) {
|
|
5467
|
+
continue;
|
|
5468
|
+
}
|
|
5463
5469
|
const cellData = {};
|
|
5464
5470
|
let cellDataExists = false;
|
|
5465
5471
|
for (const band in tile.data.cells.numericProps) {
|
|
@@ -5471,7 +5477,7 @@ function tileFeaturesRaster({
|
|
|
5471
5477
|
}
|
|
5472
5478
|
}
|
|
5473
5479
|
if (cellDataExists) {
|
|
5474
|
-
data.set(
|
|
5480
|
+
data.set(tileSortedCells[i], cellData);
|
|
5475
5481
|
}
|
|
5476
5482
|
}
|
|
5477
5483
|
}
|
|
@@ -6271,7 +6277,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6271
6277
|
spatialFiltersMode,
|
|
6272
6278
|
...params
|
|
6273
6279
|
} = options;
|
|
6274
|
-
const { column, operation: operation2, operationColumn, operationExp
|
|
6280
|
+
const { column, operation: operation2, operationColumn, operationExp } = params;
|
|
6275
6281
|
if (operation2 === AggregationTypes.Custom) {
|
|
6276
6282
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6277
6283
|
}
|
|
@@ -6286,8 +6292,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6286
6292
|
column,
|
|
6287
6293
|
operation: operation2,
|
|
6288
6294
|
operationExp,
|
|
6289
|
-
operationColumn: operationColumn || column
|
|
6290
|
-
othersThreshold
|
|
6295
|
+
operationColumn: operationColumn || column
|
|
6291
6296
|
},
|
|
6292
6297
|
opts: { signal, headers: this.props.headers }
|
|
6293
6298
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
@@ -6677,17 +6682,13 @@ function normalizeSortByOptions({
|
|
|
6677
6682
|
});
|
|
6678
6683
|
}
|
|
6679
6684
|
|
|
6680
|
-
// src/widget-sources/constants.ts
|
|
6681
|
-
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
6682
|
-
|
|
6683
6685
|
// src/operations/groupBy.ts
|
|
6684
6686
|
function groupValuesByColumn({
|
|
6685
6687
|
data,
|
|
6686
6688
|
valuesColumns,
|
|
6687
6689
|
joinOperation,
|
|
6688
6690
|
keysColumn,
|
|
6689
|
-
operation: operation2
|
|
6690
|
-
othersThreshold
|
|
6691
|
+
operation: operation2
|
|
6691
6692
|
}) {
|
|
6692
6693
|
if (Array.isArray(data) && data.length === 0) {
|
|
6693
6694
|
return null;
|
|
@@ -6705,23 +6706,13 @@ function groupValuesByColumn({
|
|
|
6705
6706
|
return accumulator;
|
|
6706
6707
|
}, /* @__PURE__ */ new Map());
|
|
6707
6708
|
const targetOperation = aggregationFunctions[operation2];
|
|
6708
|
-
if (
|
|
6709
|
-
return []
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
value: targetOperation(value)
|
|
6714
|
-
}));
|
|
6715
|
-
allCategories.sort((a, b) => b.value - a.value);
|
|
6716
|
-
if (othersThreshold && allCategories.length > othersThreshold) {
|
|
6717
|
-
const otherNames = allCategories.map((entry) => entry.name).slice(othersThreshold);
|
|
6718
|
-
const otherValue = otherNames.flatMap((name) => groups.get(name));
|
|
6719
|
-
allCategories.push({
|
|
6720
|
-
name: OTHERS_CATEGORY_NAME,
|
|
6721
|
-
value: targetOperation(otherValue)
|
|
6722
|
-
});
|
|
6709
|
+
if (targetOperation) {
|
|
6710
|
+
return Array.from(groups).map(([name, value]) => ({
|
|
6711
|
+
name,
|
|
6712
|
+
value: targetOperation(value)
|
|
6713
|
+
}));
|
|
6723
6714
|
}
|
|
6724
|
-
return
|
|
6715
|
+
return [];
|
|
6725
6716
|
}
|
|
6726
6717
|
|
|
6727
6718
|
// src/utils/dateUtils.ts
|
|
@@ -7284,8 +7275,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7284
7275
|
joinOperation,
|
|
7285
7276
|
filters,
|
|
7286
7277
|
filterOwner,
|
|
7287
|
-
spatialFilter
|
|
7288
|
-
othersThreshold
|
|
7278
|
+
spatialFilter
|
|
7289
7279
|
}) {
|
|
7290
7280
|
const filteredFeatures = this._getFilteredFeatures(
|
|
7291
7281
|
spatialFilter,
|
|
@@ -7301,8 +7291,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7301
7291
|
valuesColumns: normalizeColumns(operationColumn || column),
|
|
7302
7292
|
joinOperation,
|
|
7303
7293
|
keysColumn: column,
|
|
7304
|
-
operation: operation2
|
|
7305
|
-
othersThreshold
|
|
7294
|
+
operation: operation2
|
|
7306
7295
|
});
|
|
7307
7296
|
return groups || [];
|
|
7308
7297
|
}
|
|
@@ -9980,16 +9969,72 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
9980
9969
|
Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS)
|
|
9981
9970
|
);
|
|
9982
9971
|
}
|
|
9972
|
+
|
|
9973
|
+
// src/utils/CellSet.ts
|
|
9974
|
+
var EMPTY_U32 = 2 ** 32 - 1;
|
|
9975
|
+
var CellSet = class {
|
|
9976
|
+
constructor(cells) {
|
|
9977
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
9978
|
+
__publicField(this, "cells");
|
|
9979
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
9980
|
+
__publicField(this, "cellView", new DataView(new ArrayBuffer(8)));
|
|
9981
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
9982
|
+
__publicField(this, "hashTable");
|
|
9983
|
+
this.cells = cells;
|
|
9984
|
+
this.hashTable = new Uint32Array(hashBuckets(cells.length)).fill(EMPTY_U32);
|
|
9985
|
+
for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
|
|
9986
|
+
this.hashTable[this.hashLookup(cells[cellIndex])] = cellIndex;
|
|
9987
|
+
}
|
|
9988
|
+
}
|
|
9989
|
+
has(cell) {
|
|
9990
|
+
const hashIndex = this.hashLookup(cell);
|
|
9991
|
+
return this.hashTable[hashIndex] !== EMPTY_U32;
|
|
9992
|
+
}
|
|
9993
|
+
hashLookup(cell) {
|
|
9994
|
+
this.cellView.setBigUint64(0, cell);
|
|
9995
|
+
const hashval = hash(this.cellView);
|
|
9996
|
+
const hashmod = this.hashTable.length - 1;
|
|
9997
|
+
let bucket = hashval & hashmod;
|
|
9998
|
+
for (let probe = 0; probe <= hashmod; probe++) {
|
|
9999
|
+
const cellIndex = this.hashTable[bucket];
|
|
10000
|
+
if (cellIndex === EMPTY_U32 || cell === this.cells[cellIndex]) {
|
|
10001
|
+
return bucket;
|
|
10002
|
+
}
|
|
10003
|
+
bucket = bucket + probe + 1 & hashmod;
|
|
10004
|
+
}
|
|
10005
|
+
throw new Error("Hash table full.");
|
|
10006
|
+
}
|
|
10007
|
+
};
|
|
10008
|
+
function hash(view, h = 0) {
|
|
10009
|
+
const m = 1540483477;
|
|
10010
|
+
const r = 24;
|
|
10011
|
+
for (let i = 0, il = view.byteLength / 4; i < il; i++) {
|
|
10012
|
+
let k = view.getUint32(i * 4);
|
|
10013
|
+
k = Math.imul(k, m) >>> 0;
|
|
10014
|
+
k = (k ^ k >> r) >>> 0;
|
|
10015
|
+
k = Math.imul(k, m) >>> 0;
|
|
10016
|
+
h = Math.imul(h, m) >>> 0;
|
|
10017
|
+
h = (h ^ k) >>> 0;
|
|
10018
|
+
}
|
|
10019
|
+
return h;
|
|
10020
|
+
}
|
|
10021
|
+
function hashBuckets(initialCount) {
|
|
10022
|
+
let buckets = 1;
|
|
10023
|
+
while (buckets < initialCount + initialCount / 4) {
|
|
10024
|
+
buckets *= 2;
|
|
10025
|
+
}
|
|
10026
|
+
return buckets;
|
|
10027
|
+
}
|
|
9983
10028
|
export {
|
|
9984
10029
|
AggregationTypes,
|
|
9985
10030
|
ApiVersion,
|
|
9986
10031
|
basemap_styles_default as BASEMAP,
|
|
9987
10032
|
CartoAPIError,
|
|
10033
|
+
CellSet,
|
|
9988
10034
|
DEFAULT_API_BASE_URL,
|
|
9989
10035
|
FEATURE_GEOM_PROPERTY,
|
|
9990
10036
|
FilterType,
|
|
9991
10037
|
OPACITY_MAP,
|
|
9992
|
-
OTHERS_CATEGORY_NAME,
|
|
9993
10038
|
Provider,
|
|
9994
10039
|
SOURCE_DEFAULTS,
|
|
9995
10040
|
SchemaFieldType,
|