@carto/api-client 0.5.14 → 0.5.15-alpha.raster-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/build/api-client.cjs +765 -48
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +67 -3
- package/build/api-client.d.ts +67 -3
- package/build/api-client.js +753 -46
- package/build/api-client.js.map +1 -1
- package/package.json +4 -2
- package/src/fetch-map/index.ts +1 -0
- package/src/fetch-map/layer-map.ts +40 -12
- package/src/fetch-map/parse-map.ts +153 -70
- package/src/fetch-map/raster-layer.ts +534 -0
- package/src/fetch-map/types.ts +14 -0
- package/src/fetch-map/vec-expr-evaluator.ts +386 -0
- package/src/index.ts +12 -1
package/build/api-client.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Feature, Polygon, MultiPolygon, BBox, FeatureCollection, Geometry } from 'geojson';
|
|
2
2
|
import { BinaryFeatureCollection, BinaryFeature } from '@loaders.gl/schema';
|
|
3
|
+
import jsep from 'jsep';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Returns current client ID, used to categorize API requests. For internal use only.
|
|
@@ -750,6 +751,8 @@ declare function getColorAccessor({ name, colorColumn }: VisualChannelField, sca
|
|
|
750
751
|
accessor: any;
|
|
751
752
|
scale: any;
|
|
752
753
|
};
|
|
754
|
+
declare function calculateLayerScale(name: string, scaleType: ScaleType, range: ColorRange, data: TilejsonResult): D3Scale;
|
|
755
|
+
declare function createColorScale<T>(scaleType: ScaleType, domain: string[] | number[], range: T[], unknown: T): D3Scale;
|
|
753
756
|
declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
754
757
|
fallbackUrl?: string | null;
|
|
755
758
|
maxIconSize: number;
|
|
@@ -804,6 +807,7 @@ type ColorRange = {
|
|
|
804
807
|
colorMap: string[][] | undefined;
|
|
805
808
|
name: string;
|
|
806
809
|
type: string;
|
|
810
|
+
uiCustomScaleType?: 'logarithmic';
|
|
807
811
|
};
|
|
808
812
|
type CustomMarkersRange = {
|
|
809
813
|
markerMap: {
|
|
@@ -812,6 +816,12 @@ type CustomMarkersRange = {
|
|
|
812
816
|
}[];
|
|
813
817
|
othersMarker?: string;
|
|
814
818
|
};
|
|
819
|
+
type ColorBand = 'red' | 'green' | 'blue' | 'alpha';
|
|
820
|
+
type RasterLayerConfigColorBand = {
|
|
821
|
+
band: ColorBand;
|
|
822
|
+
type: 'none' | 'band' | 'expression';
|
|
823
|
+
value: string;
|
|
824
|
+
};
|
|
815
825
|
type VisConfig = {
|
|
816
826
|
filled?: boolean;
|
|
817
827
|
opacity?: number;
|
|
@@ -833,6 +843,9 @@ type VisConfig = {
|
|
|
833
843
|
weightAggregation?: any;
|
|
834
844
|
clusterLevel?: number;
|
|
835
845
|
isTextVisible?: boolean;
|
|
846
|
+
rasterStyleType?: 'Rgb' | 'ColorRange' | 'UniqueValues';
|
|
847
|
+
colorBands?: RasterLayerConfigColorBand[];
|
|
848
|
+
uniqueValuesColorRange?: ColorRange;
|
|
836
849
|
};
|
|
837
850
|
type TextLabel = {
|
|
838
851
|
field: VisualChannelField | null | undefined;
|
|
@@ -976,17 +989,32 @@ declare const _default: {
|
|
|
976
989
|
readonly DARK_MATTER_NOLABELS: string;
|
|
977
990
|
};
|
|
978
991
|
|
|
992
|
+
declare function getRasterTileLayerStyleProps({ layerConfig, visualChannels, rasterMetadata, }: {
|
|
993
|
+
layerConfig: MapLayerConfig;
|
|
994
|
+
visualChannels: VisualChannels;
|
|
995
|
+
rasterMetadata: RasterMetadata;
|
|
996
|
+
}): {
|
|
997
|
+
dataTransform: () => any;
|
|
998
|
+
updateTriggers: {
|
|
999
|
+
getFillColor: Record<string, unknown>;
|
|
1000
|
+
};
|
|
1001
|
+
} | {
|
|
1002
|
+
dataTransform?: undefined;
|
|
1003
|
+
updateTriggers?: undefined;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
979
1006
|
type Scale = {
|
|
980
1007
|
field: VisualChannelField;
|
|
981
1008
|
domain: string[] | number[];
|
|
982
1009
|
range: string[] | number[];
|
|
983
1010
|
type: ScaleType;
|
|
984
1011
|
};
|
|
1012
|
+
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
985
1013
|
type LayerDescriptor = {
|
|
986
1014
|
type: LayerType;
|
|
987
1015
|
props: Record<string, any>;
|
|
988
1016
|
filters?: Filters;
|
|
989
|
-
scales: Record<ScaleKey, Scale
|
|
1017
|
+
scales: Partial<Record<ScaleKey, Scale>>;
|
|
990
1018
|
};
|
|
991
1019
|
type ParseMapResult = {
|
|
992
1020
|
/** Map id. */
|
|
@@ -1004,6 +1032,11 @@ type ParseMapResult = {
|
|
|
1004
1032
|
token: string;
|
|
1005
1033
|
layers: LayerDescriptor[];
|
|
1006
1034
|
};
|
|
1035
|
+
declare function getLayerDescriptor({ mapConfig, layer, dataset, }: {
|
|
1036
|
+
mapConfig: KeplerMapConfig;
|
|
1037
|
+
layer: MapConfigLayer;
|
|
1038
|
+
dataset: Dataset;
|
|
1039
|
+
}): LayerDescriptor;
|
|
1007
1040
|
declare function parseMap(json: any): {
|
|
1008
1041
|
id: any;
|
|
1009
1042
|
title: any;
|
|
@@ -1021,7 +1054,6 @@ declare function parseMap(json: any): {
|
|
|
1021
1054
|
token: any;
|
|
1022
1055
|
layers: (LayerDescriptor | undefined)[];
|
|
1023
1056
|
};
|
|
1024
|
-
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
1025
1057
|
|
|
1026
1058
|
type FetchMapOptions = {
|
|
1027
1059
|
/**
|
|
@@ -1085,6 +1117,38 @@ declare function fetchBasemapProps({ config, errorContext, applyLayerFilters, }:
|
|
|
1085
1117
|
errorContext?: APIErrorContext;
|
|
1086
1118
|
}): Promise<Basemap | null>;
|
|
1087
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* Create vector expresion evaluator.
|
|
1122
|
+
*
|
|
1123
|
+
* Used to calculate vector expressions, such as `(band_1 * 3) + band_2/2`,
|
|
1124
|
+
* where `band_1` and `band_2` are arrays or typed arrays.
|
|
1125
|
+
*
|
|
1126
|
+
* Note that all vector operations are element-wise, in paricular `band_1 * band_2`
|
|
1127
|
+
* is not "mathematical" dot or cross product, but just element-wise multiplication.
|
|
1128
|
+
*
|
|
1129
|
+
* Based on:
|
|
1130
|
+
* - Copyright (c) 2013 Stephen Oney, http://jsep.from.so/, MIT License
|
|
1131
|
+
* - Copyright (c) 2023 Don McCurdy, https://github.com/donmccurdy/expression-eval, MIT License
|
|
1132
|
+
*/
|
|
1133
|
+
declare function createVecExprEvaluator(expression: string | jsep.Expression): VecExprEvaluator | null;
|
|
1134
|
+
declare function evaluateVecExpr(expression: string | jsep.Expression, context: Record<string, VecExprResult>): VecExprResult | null | undefined;
|
|
1135
|
+
declare enum ErrorCode {
|
|
1136
|
+
InvalidSyntax = 0,
|
|
1137
|
+
UnknownIdentifier = 1
|
|
1138
|
+
}
|
|
1139
|
+
type ValidationResult = {
|
|
1140
|
+
valid: boolean;
|
|
1141
|
+
errorCode?: ErrorCode;
|
|
1142
|
+
errorMessage?: string;
|
|
1143
|
+
};
|
|
1144
|
+
declare function validateVecExprSyntax(expression: string | jsep.Expression, context: Record<string, unknown>): ValidationResult;
|
|
1145
|
+
type VecExprVecLike = number[] | Float32Array | Float64Array | Uint8Array | Int8Array | Int32Array | Uint32Array | Uint16Array | Int16Array;
|
|
1146
|
+
type VecExprResult = number | VecExprVecLike;
|
|
1147
|
+
type VecExprEvaluator = {
|
|
1148
|
+
(context: object): VecExprResult;
|
|
1149
|
+
symbols?: string[];
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1088
1152
|
type FilterTypeOptions<T extends FilterType> = {
|
|
1089
1153
|
type: T;
|
|
1090
1154
|
column: string;
|
|
@@ -1987,4 +2051,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1987
2051
|
*/
|
|
1988
2052
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1989
2053
|
|
|
1990
|
-
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 CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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, getSorter, 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 };
|
|
2054
|
+
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 CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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, ErrorCode as _ErrorCode, type VecExprResult as _VecExprResult, _buildFeatureFilter, createVecExprEvaluator as _createVecExprEvaluator, domainFromValues as _domainFromValues, evaluateVecExpr as _evaluateVecExpr, _getHexagonResolution, getRasterTileLayerStyleProps as _getRasterTileLayerStyleProps, validateVecExprSyntax as _validateVecExprSyntax, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, calculateLayerScale, clearDefaultRequestCache, clearFilters, configureSource, createColorScale, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerDescriptor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSorter, 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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Feature, Polygon, MultiPolygon, BBox, FeatureCollection, Geometry } from 'geojson';
|
|
2
2
|
import { BinaryFeatureCollection, BinaryFeature } from '@loaders.gl/schema';
|
|
3
|
+
import jsep from 'jsep';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Returns current client ID, used to categorize API requests. For internal use only.
|
|
@@ -750,6 +751,8 @@ declare function getColorAccessor({ name, colorColumn }: VisualChannelField, sca
|
|
|
750
751
|
accessor: any;
|
|
751
752
|
scale: any;
|
|
752
753
|
};
|
|
754
|
+
declare function calculateLayerScale(name: string, scaleType: ScaleType, range: ColorRange, data: TilejsonResult): D3Scale;
|
|
755
|
+
declare function createColorScale<T>(scaleType: ScaleType, domain: string[] | number[], range: T[], unknown: T): D3Scale;
|
|
753
756
|
declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
754
757
|
fallbackUrl?: string | null;
|
|
755
758
|
maxIconSize: number;
|
|
@@ -804,6 +807,7 @@ type ColorRange = {
|
|
|
804
807
|
colorMap: string[][] | undefined;
|
|
805
808
|
name: string;
|
|
806
809
|
type: string;
|
|
810
|
+
uiCustomScaleType?: 'logarithmic';
|
|
807
811
|
};
|
|
808
812
|
type CustomMarkersRange = {
|
|
809
813
|
markerMap: {
|
|
@@ -812,6 +816,12 @@ type CustomMarkersRange = {
|
|
|
812
816
|
}[];
|
|
813
817
|
othersMarker?: string;
|
|
814
818
|
};
|
|
819
|
+
type ColorBand = 'red' | 'green' | 'blue' | 'alpha';
|
|
820
|
+
type RasterLayerConfigColorBand = {
|
|
821
|
+
band: ColorBand;
|
|
822
|
+
type: 'none' | 'band' | 'expression';
|
|
823
|
+
value: string;
|
|
824
|
+
};
|
|
815
825
|
type VisConfig = {
|
|
816
826
|
filled?: boolean;
|
|
817
827
|
opacity?: number;
|
|
@@ -833,6 +843,9 @@ type VisConfig = {
|
|
|
833
843
|
weightAggregation?: any;
|
|
834
844
|
clusterLevel?: number;
|
|
835
845
|
isTextVisible?: boolean;
|
|
846
|
+
rasterStyleType?: 'Rgb' | 'ColorRange' | 'UniqueValues';
|
|
847
|
+
colorBands?: RasterLayerConfigColorBand[];
|
|
848
|
+
uniqueValuesColorRange?: ColorRange;
|
|
836
849
|
};
|
|
837
850
|
type TextLabel = {
|
|
838
851
|
field: VisualChannelField | null | undefined;
|
|
@@ -976,17 +989,32 @@ declare const _default: {
|
|
|
976
989
|
readonly DARK_MATTER_NOLABELS: string;
|
|
977
990
|
};
|
|
978
991
|
|
|
992
|
+
declare function getRasterTileLayerStyleProps({ layerConfig, visualChannels, rasterMetadata, }: {
|
|
993
|
+
layerConfig: MapLayerConfig;
|
|
994
|
+
visualChannels: VisualChannels;
|
|
995
|
+
rasterMetadata: RasterMetadata;
|
|
996
|
+
}): {
|
|
997
|
+
dataTransform: () => any;
|
|
998
|
+
updateTriggers: {
|
|
999
|
+
getFillColor: Record<string, unknown>;
|
|
1000
|
+
};
|
|
1001
|
+
} | {
|
|
1002
|
+
dataTransform?: undefined;
|
|
1003
|
+
updateTriggers?: undefined;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
979
1006
|
type Scale = {
|
|
980
1007
|
field: VisualChannelField;
|
|
981
1008
|
domain: string[] | number[];
|
|
982
1009
|
range: string[] | number[];
|
|
983
1010
|
type: ScaleType;
|
|
984
1011
|
};
|
|
1012
|
+
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
985
1013
|
type LayerDescriptor = {
|
|
986
1014
|
type: LayerType;
|
|
987
1015
|
props: Record<string, any>;
|
|
988
1016
|
filters?: Filters;
|
|
989
|
-
scales: Record<ScaleKey, Scale
|
|
1017
|
+
scales: Partial<Record<ScaleKey, Scale>>;
|
|
990
1018
|
};
|
|
991
1019
|
type ParseMapResult = {
|
|
992
1020
|
/** Map id. */
|
|
@@ -1004,6 +1032,11 @@ type ParseMapResult = {
|
|
|
1004
1032
|
token: string;
|
|
1005
1033
|
layers: LayerDescriptor[];
|
|
1006
1034
|
};
|
|
1035
|
+
declare function getLayerDescriptor({ mapConfig, layer, dataset, }: {
|
|
1036
|
+
mapConfig: KeplerMapConfig;
|
|
1037
|
+
layer: MapConfigLayer;
|
|
1038
|
+
dataset: Dataset;
|
|
1039
|
+
}): LayerDescriptor;
|
|
1007
1040
|
declare function parseMap(json: any): {
|
|
1008
1041
|
id: any;
|
|
1009
1042
|
title: any;
|
|
@@ -1021,7 +1054,6 @@ declare function parseMap(json: any): {
|
|
|
1021
1054
|
token: any;
|
|
1022
1055
|
layers: (LayerDescriptor | undefined)[];
|
|
1023
1056
|
};
|
|
1024
|
-
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
1025
1057
|
|
|
1026
1058
|
type FetchMapOptions = {
|
|
1027
1059
|
/**
|
|
@@ -1085,6 +1117,38 @@ declare function fetchBasemapProps({ config, errorContext, applyLayerFilters, }:
|
|
|
1085
1117
|
errorContext?: APIErrorContext;
|
|
1086
1118
|
}): Promise<Basemap | null>;
|
|
1087
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* Create vector expresion evaluator.
|
|
1122
|
+
*
|
|
1123
|
+
* Used to calculate vector expressions, such as `(band_1 * 3) + band_2/2`,
|
|
1124
|
+
* where `band_1` and `band_2` are arrays or typed arrays.
|
|
1125
|
+
*
|
|
1126
|
+
* Note that all vector operations are element-wise, in paricular `band_1 * band_2`
|
|
1127
|
+
* is not "mathematical" dot or cross product, but just element-wise multiplication.
|
|
1128
|
+
*
|
|
1129
|
+
* Based on:
|
|
1130
|
+
* - Copyright (c) 2013 Stephen Oney, http://jsep.from.so/, MIT License
|
|
1131
|
+
* - Copyright (c) 2023 Don McCurdy, https://github.com/donmccurdy/expression-eval, MIT License
|
|
1132
|
+
*/
|
|
1133
|
+
declare function createVecExprEvaluator(expression: string | jsep.Expression): VecExprEvaluator | null;
|
|
1134
|
+
declare function evaluateVecExpr(expression: string | jsep.Expression, context: Record<string, VecExprResult>): VecExprResult | null | undefined;
|
|
1135
|
+
declare enum ErrorCode {
|
|
1136
|
+
InvalidSyntax = 0,
|
|
1137
|
+
UnknownIdentifier = 1
|
|
1138
|
+
}
|
|
1139
|
+
type ValidationResult = {
|
|
1140
|
+
valid: boolean;
|
|
1141
|
+
errorCode?: ErrorCode;
|
|
1142
|
+
errorMessage?: string;
|
|
1143
|
+
};
|
|
1144
|
+
declare function validateVecExprSyntax(expression: string | jsep.Expression, context: Record<string, unknown>): ValidationResult;
|
|
1145
|
+
type VecExprVecLike = number[] | Float32Array | Float64Array | Uint8Array | Int8Array | Int32Array | Uint32Array | Uint16Array | Int16Array;
|
|
1146
|
+
type VecExprResult = number | VecExprVecLike;
|
|
1147
|
+
type VecExprEvaluator = {
|
|
1148
|
+
(context: object): VecExprResult;
|
|
1149
|
+
symbols?: string[];
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1088
1152
|
type FilterTypeOptions<T extends FilterType> = {
|
|
1089
1153
|
type: T;
|
|
1090
1154
|
column: string;
|
|
@@ -1987,4 +2051,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1987
2051
|
*/
|
|
1988
2052
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1989
2053
|
|
|
1990
|
-
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 CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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, getSorter, 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 };
|
|
2054
|
+
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 CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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, ErrorCode as _ErrorCode, type VecExprResult as _VecExprResult, _buildFeatureFilter, createVecExprEvaluator as _createVecExprEvaluator, domainFromValues as _domainFromValues, evaluateVecExpr as _evaluateVecExpr, _getHexagonResolution, getRasterTileLayerStyleProps as _getRasterTileLayerStyleProps, validateVecExprSyntax as _validateVecExprSyntax, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, calculateLayerScale, clearDefaultRequestCache, clearFilters, configureSource, createColorScale, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerDescriptor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSorter, 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 };
|