@carto/api-client 0.5.0-alpha.9 → 0.5.1-alpha.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 +30 -1
- package/build/api-client.cjs +15241 -3358
- package/build/api-client.cjs.map +1 -0
- package/build/api-client.d.cts +528 -181
- package/build/api-client.d.ts +528 -181
- package/build/api-client.js +14685 -2911
- package/build/api-client.js.map +1 -0
- package/build/worker.js +5117 -619
- package/build/worker.js.map +1 -0
- package/package.json +49 -32
- package/src/api/query.ts +2 -1
- package/src/constants-internal.ts +10 -0
- package/src/constants.ts +5 -1
- package/src/deck/get-data-filter-extension-props.ts +27 -9
- package/src/fetch-map/basemap-styles.ts +159 -0
- package/src/fetch-map/basemap.ts +120 -0
- package/src/fetch-map/fetch-map.ts +331 -0
- package/src/fetch-map/index.ts +13 -0
- package/src/fetch-map/layer-map.ts +461 -0
- package/src/fetch-map/parse-map.ts +425 -0
- package/src/fetch-map/source.ts +233 -0
- package/src/fetch-map/types.ts +268 -0
- package/src/fetch-map/utils.ts +69 -0
- package/src/filters/tileFeatures.ts +27 -10
- package/src/filters/tileFeaturesRaster.ts +122 -0
- package/src/index.ts +1 -0
- package/src/models/model.ts +0 -7
- package/src/sources/base-source.ts +4 -2
- package/src/sources/h3-tileset-source.ts +1 -1
- package/src/sources/quadbin-tileset-source.ts +1 -1
- package/src/sources/raster-source.ts +18 -5
- package/src/sources/types.ts +15 -8
- package/src/sources/vector-tileset-source.ts +1 -1
- package/src/spatial-index.ts +3 -84
- package/src/types.ts +16 -2
- package/src/widget-sources/index.ts +1 -0
- package/src/widget-sources/types.ts +1 -3
- package/src/widget-sources/widget-raster-source.ts +14 -0
- package/src/widget-sources/widget-remote-source.ts +16 -91
- package/src/widget-sources/widget-source.ts +9 -25
- package/src/widget-sources/widget-tileset-source-impl.ts +16 -19
- package/src/widget-sources/widget-tileset-source.ts +24 -21
- package/src/workers/widget-tileset-worker.ts +1 -1
package/build/api-client.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Polygon, MultiPolygon,
|
|
1
|
+
import { Feature, Polygon, MultiPolygon, BBox, FeatureCollection, Geometry } from 'geojson';
|
|
2
2
|
import { BinaryFeatureCollection, BinaryFeature } from '@loaders.gl/schema';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -57,7 +57,6 @@ declare enum TileFormat {
|
|
|
57
57
|
/** @privateRemarks Source: @carto/react-core */
|
|
58
58
|
declare enum SpatialIndex {
|
|
59
59
|
H3 = "h3",
|
|
60
|
-
S2 = "s2",
|
|
61
60
|
QUADBIN = "quadbin"
|
|
62
61
|
}
|
|
63
62
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -69,6 +68,10 @@ declare enum Provider {
|
|
|
69
68
|
DATABRICKS = "databricks",
|
|
70
69
|
DATABRICKS_REST = "databricksRest"
|
|
71
70
|
}
|
|
71
|
+
declare const SpatialIndexColumn: Readonly<{
|
|
72
|
+
h3: string[];
|
|
73
|
+
quadbin: string[];
|
|
74
|
+
}>;
|
|
72
75
|
|
|
73
76
|
/******************************************************************************
|
|
74
77
|
* MAPS AND TILES
|
|
@@ -77,6 +80,8 @@ declare enum Provider {
|
|
|
77
80
|
type Format = 'json' | 'geojson' | 'tilejson';
|
|
78
81
|
/** @privateRemarks Source: @carto/constants, @deck.gl/carto */
|
|
79
82
|
type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
83
|
+
/** @privateRemarks Source: cloud-native */
|
|
84
|
+
type ProviderType = 'bigquery' | 'postgres' | 'snowflake' | 'redshift' | 'databricks' | 'carto' | 'carto_dw';
|
|
80
85
|
/**
|
|
81
86
|
* Alias for GeoJSON 'BBox' type, semantically representing a viewport.
|
|
82
87
|
* Order of values is "west", "south", "east", "north".
|
|
@@ -96,8 +101,6 @@ type Tile = {
|
|
|
96
101
|
z: number;
|
|
97
102
|
};
|
|
98
103
|
id: string;
|
|
99
|
-
content: unknown;
|
|
100
|
-
zoom: number;
|
|
101
104
|
bbox: {
|
|
102
105
|
west: number;
|
|
103
106
|
east: number;
|
|
@@ -113,6 +116,14 @@ type SpatialIndexTile = Tile & {
|
|
|
113
116
|
id: bigint;
|
|
114
117
|
})[];
|
|
115
118
|
};
|
|
119
|
+
type RasterTile = Tile & {
|
|
120
|
+
id: string;
|
|
121
|
+
index: {
|
|
122
|
+
q: bigint;
|
|
123
|
+
i: string;
|
|
124
|
+
};
|
|
125
|
+
data?: Raster;
|
|
126
|
+
};
|
|
116
127
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
117
128
|
type Raster = {
|
|
118
129
|
blockSize: number;
|
|
@@ -225,68 +236,63 @@ type _DataFilterExtensionProps = {
|
|
|
225
236
|
};
|
|
226
237
|
/**
|
|
227
238
|
* Creates props for DataFilterExtension, from `@deck.gl/extensions`, given
|
|
228
|
-
* a set of filters.
|
|
239
|
+
* a set of filters. Requires that DataFilterExtension is initialized with
|
|
240
|
+
* filterSize=4, where the CARTO filters will occupy the first two slots.
|
|
241
|
+
*
|
|
242
|
+
* @example To create a deck.gl layer with GPU data filtering:
|
|
243
|
+
* ```typescript
|
|
244
|
+
* import {DataFilterExtension} from '@deck.gl/extensions';
|
|
245
|
+
* import {VectorTileLayer} from '@deck.gl/layers';
|
|
246
|
+
* import {getDataFilterExtensionProps} from '@carto/api-client';
|
|
229
247
|
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
248
|
+
* const layer = new VectorTileLayer({
|
|
249
|
+
* data: data,
|
|
250
|
+
* extensions: [new DataFilterExtension({filterSize: 4})],
|
|
251
|
+
* ...getDataFilterExtensionProps(filters),
|
|
252
|
+
* });
|
|
253
|
+
* ```
|
|
233
254
|
*/
|
|
234
|
-
declare function getDataFilterExtensionProps(filters: Filters, filtersLogicalOperator?: FilterLogicalOperator
|
|
255
|
+
declare function getDataFilterExtensionProps(filters: Filters, filtersLogicalOperator?: FilterLogicalOperator): _DataFilterExtensionProps;
|
|
235
256
|
|
|
236
|
-
type
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
* `column` and `type` will be replaced.
|
|
244
|
-
*/
|
|
245
|
-
declare function addFilter(filters: Record<string, Filter>, { column, type, values, owner }: AddFilterOptions): Record<string, Filter>;
|
|
246
|
-
type RemoveFilterOptions = {
|
|
247
|
-
column: string;
|
|
248
|
-
owner?: string;
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Removes one or more {@link Filter filters} from the filter set. If only
|
|
252
|
-
* `column` is specified, then all filters on that column are removed. If both
|
|
253
|
-
* `column` and `owner` are specified, then only filters for that column
|
|
254
|
-
* associated with the owner are removed.
|
|
255
|
-
*/
|
|
256
|
-
declare function removeFilter(filters: Record<string, Filter>, { column, owner }: RemoveFilterOptions): Record<string, Filter>;
|
|
257
|
-
/**
|
|
258
|
-
* Clears all {@link Filter filters} from the filter set.
|
|
259
|
-
*/
|
|
260
|
-
declare function clearFilters(filters: Record<string, Filter>): Record<string, Filter>;
|
|
261
|
-
type HasFilterOptions = {
|
|
262
|
-
column: string;
|
|
263
|
-
owner?: string;
|
|
264
|
-
};
|
|
265
|
-
declare function hasFilter(filters: Record<string, Filter>, { column, owner }: HasFilterOptions): boolean;
|
|
266
|
-
type GetFilterOptions<T extends FilterType> = {
|
|
267
|
-
column: string;
|
|
268
|
-
type: T;
|
|
269
|
-
owner?: string;
|
|
257
|
+
type APIRequestType = 'Map data' | 'Map instantiation' | 'Public map' | 'Tile stats' | 'SQL' | 'Basemap style';
|
|
258
|
+
type APIErrorContext = {
|
|
259
|
+
requestType: APIRequestType;
|
|
260
|
+
mapId?: string;
|
|
261
|
+
connection?: string;
|
|
262
|
+
source?: string;
|
|
263
|
+
type?: MapType;
|
|
270
264
|
};
|
|
271
|
-
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
272
|
-
|
|
273
265
|
/**
|
|
274
|
-
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
275
|
-
* from deck.gl's `viewport.getBounds()` method ([west, south, east, north]).
|
|
276
|
-
* If the viewport covers the entire world (to some margin of error in Web
|
|
277
|
-
* Mercator space), `undefined` is returned instead.
|
|
278
266
|
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
|
|
282
|
-
declare function createViewportSpatialFilter(viewport: BBox): SpatialFilter | undefined;
|
|
283
|
-
/**
|
|
284
|
-
* Returns a {@link SpatialFilter} for a given {@link Polygon} or
|
|
285
|
-
* {@link MultiPolygon}. If the polygon(s) extend outside longitude
|
|
286
|
-
* range [-180, +180], the result may be reformatted for compatibility
|
|
287
|
-
* with CARTO APIs.
|
|
267
|
+
* Custom error for reported errors in CARTO Maps API.
|
|
268
|
+
* Provides useful debugging information in console and context for applications.
|
|
269
|
+
*
|
|
288
270
|
*/
|
|
289
|
-
declare
|
|
271
|
+
declare class CartoAPIError extends Error {
|
|
272
|
+
/** Source error from server */
|
|
273
|
+
error: Error;
|
|
274
|
+
/** Context (API call & parameters) in which error occured */
|
|
275
|
+
errorContext: APIErrorContext;
|
|
276
|
+
/** Response from server */
|
|
277
|
+
response?: Response;
|
|
278
|
+
/** JSON Response from server */
|
|
279
|
+
responseJson?: any;
|
|
280
|
+
constructor(error: Error, errorContext: APIErrorContext, response?: Response, responseJson?: any);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** @internal Required by fetchMap(). */
|
|
284
|
+
declare function buildPublicMapUrl({ apiBaseUrl, cartoMapId, }: {
|
|
285
|
+
apiBaseUrl: string;
|
|
286
|
+
cartoMapId: string;
|
|
287
|
+
}): string;
|
|
288
|
+
/** @internal Required by fetchMap(). */
|
|
289
|
+
declare function buildStatsUrl({ attribute, apiBaseUrl, connectionName, source, type, }: {
|
|
290
|
+
attribute: string;
|
|
291
|
+
apiBaseUrl: string;
|
|
292
|
+
connectionName: string;
|
|
293
|
+
source: string;
|
|
294
|
+
type: MapType;
|
|
295
|
+
}): string;
|
|
290
296
|
|
|
291
297
|
type SourceRequiredOptions = {
|
|
292
298
|
/** Carto platform access token. */
|
|
@@ -384,10 +390,6 @@ type AggregationOptions = {
|
|
|
384
390
|
* @default 6 for quadbin and 4 for h3 sources
|
|
385
391
|
*/
|
|
386
392
|
aggregationResLevel?: number;
|
|
387
|
-
/**
|
|
388
|
-
* Original resolution of the spatial index data as stored in the DW
|
|
389
|
-
*/
|
|
390
|
-
dataResolution?: number;
|
|
391
393
|
};
|
|
392
394
|
type FilterOptions = {
|
|
393
395
|
/**
|
|
@@ -455,7 +457,7 @@ type TilesetSourceOptions = {
|
|
|
455
457
|
* Whether to use Web Workers for local widget calculations. Workers
|
|
456
458
|
* are used by default if the runtime environment supports ES Module Workers.
|
|
457
459
|
*/
|
|
458
|
-
|
|
460
|
+
widgetWorker?: boolean;
|
|
459
461
|
};
|
|
460
462
|
type ColumnsOption = {
|
|
461
463
|
/**
|
|
@@ -592,8 +594,9 @@ declare enum RasterBandColorinterp {
|
|
|
592
594
|
Alpha = "alpha",
|
|
593
595
|
Palette = "palette"
|
|
594
596
|
}
|
|
597
|
+
type RasterBandType = 'uint8' | 'int8' | 'uint16' | 'int16' | 'uint32' | 'int32' | 'uint64' | 'int64' | 'float32' | 'float64';
|
|
595
598
|
type RasterMetadataBand = {
|
|
596
|
-
type:
|
|
599
|
+
type: RasterBandType;
|
|
597
600
|
name: string;
|
|
598
601
|
stats: RasterMetadataBandStats;
|
|
599
602
|
/**
|
|
@@ -606,7 +609,7 @@ type RasterMetadataBand = {
|
|
|
606
609
|
/**
|
|
607
610
|
* Default color mapping for unique values (or if coloprinterp is `palette`)
|
|
608
611
|
*/
|
|
609
|
-
colortable?: Record<string, number
|
|
612
|
+
colortable?: Record<string, [number, number, number, number]>;
|
|
610
613
|
/**
|
|
611
614
|
* No value representation.
|
|
612
615
|
* Observed values:
|
|
@@ -652,7 +655,399 @@ type QueryResult = {
|
|
|
652
655
|
}[];
|
|
653
656
|
};
|
|
654
657
|
|
|
655
|
-
|
|
658
|
+
type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
659
|
+
declare const query: (options: QueryOptions) => Promise<QueryResult>;
|
|
660
|
+
|
|
661
|
+
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache, }: {
|
|
662
|
+
baseUrl: string;
|
|
663
|
+
parameters?: Record<string, unknown>;
|
|
664
|
+
headers?: Record<string, string>;
|
|
665
|
+
errorContext: APIErrorContext;
|
|
666
|
+
maxLengthURL?: number;
|
|
667
|
+
localCache?: LocalCacheOptions;
|
|
668
|
+
}): Promise<T>;
|
|
669
|
+
|
|
670
|
+
type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
|
|
671
|
+
|
|
672
|
+
declare const SCALE_FUNCS: Record<string, () => any>;
|
|
673
|
+
type SCALE_TYPE = keyof typeof SCALE_FUNCS;
|
|
674
|
+
declare const AGGREGATION: Record<string, string>;
|
|
675
|
+
declare const OPACITY_MAP: Record<string, string>;
|
|
676
|
+
declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
|
|
677
|
+
propMap: any;
|
|
678
|
+
defaultProps: any;
|
|
679
|
+
};
|
|
680
|
+
declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
|
|
681
|
+
declare function opacityToAlpha(opacity?: number): number;
|
|
682
|
+
declare function getColorValueAccessor({ name }: VisualChannelField, colorAggregation: string, data: any): any;
|
|
683
|
+
declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
|
|
684
|
+
aggregation: string;
|
|
685
|
+
range: any;
|
|
686
|
+
}, opacity: number | undefined, data: any): any;
|
|
687
|
+
declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
688
|
+
fallbackUrl?: string | null;
|
|
689
|
+
maxIconSize: number;
|
|
690
|
+
useMaskedIcons?: boolean;
|
|
691
|
+
}, data: any): any;
|
|
692
|
+
declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
|
|
693
|
+
type Accessor = number | ((d: any, i: any) => number);
|
|
694
|
+
declare function negateAccessor(accessor: Accessor): Accessor;
|
|
695
|
+
declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
|
|
696
|
+
declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
|
|
697
|
+
|
|
698
|
+
type VisualChannelField = {
|
|
699
|
+
name: string;
|
|
700
|
+
type: string;
|
|
701
|
+
colorColumn?: string;
|
|
702
|
+
};
|
|
703
|
+
type VisualChannels = {
|
|
704
|
+
colorField?: VisualChannelField;
|
|
705
|
+
colorScale?: SCALE_TYPE;
|
|
706
|
+
customMarkersField?: VisualChannelField;
|
|
707
|
+
customMarkersScale?: SCALE_TYPE;
|
|
708
|
+
radiusField?: VisualChannelField;
|
|
709
|
+
radiusScale?: SCALE_TYPE;
|
|
710
|
+
rotationScale?: SCALE_TYPE;
|
|
711
|
+
rotationField?: VisualChannelField;
|
|
712
|
+
sizeField?: VisualChannelField;
|
|
713
|
+
sizeScale?: SCALE_TYPE;
|
|
714
|
+
strokeColorField?: VisualChannelField;
|
|
715
|
+
strokeColorScale?: SCALE_TYPE;
|
|
716
|
+
heightField?: VisualChannelField;
|
|
717
|
+
heightScale?: SCALE_TYPE;
|
|
718
|
+
weightField?: VisualChannelField;
|
|
719
|
+
};
|
|
720
|
+
type ColorRange = {
|
|
721
|
+
category: string;
|
|
722
|
+
colors: string[];
|
|
723
|
+
colorMap: string[][] | undefined;
|
|
724
|
+
name: string;
|
|
725
|
+
type: string;
|
|
726
|
+
};
|
|
727
|
+
type CustomMarkersRange = {
|
|
728
|
+
markerMap: {
|
|
729
|
+
value: string;
|
|
730
|
+
markerUrl?: string;
|
|
731
|
+
}[];
|
|
732
|
+
othersMarker?: string;
|
|
733
|
+
};
|
|
734
|
+
type VisConfig = {
|
|
735
|
+
filled?: boolean;
|
|
736
|
+
opacity?: number;
|
|
737
|
+
enable3d?: boolean;
|
|
738
|
+
colorAggregation?: any;
|
|
739
|
+
colorRange: ColorRange;
|
|
740
|
+
customMarkers?: boolean;
|
|
741
|
+
customMarkersRange?: CustomMarkersRange | null;
|
|
742
|
+
customMarkersUrl?: string | null;
|
|
743
|
+
radius: number;
|
|
744
|
+
radiusRange?: number[];
|
|
745
|
+
sizeAggregation?: any;
|
|
746
|
+
sizeRange?: any;
|
|
747
|
+
strokeColorAggregation?: any;
|
|
748
|
+
strokeOpacity?: number;
|
|
749
|
+
strokeColorRange?: ColorRange;
|
|
750
|
+
heightRange?: any;
|
|
751
|
+
heightAggregation?: any;
|
|
752
|
+
weightAggregation?: any;
|
|
753
|
+
};
|
|
754
|
+
type TextLabel = {
|
|
755
|
+
field: VisualChannelField | null | undefined;
|
|
756
|
+
alignment?: 'center' | 'bottom' | 'top';
|
|
757
|
+
anchor?: 'middle' | 'start' | 'end';
|
|
758
|
+
size: number;
|
|
759
|
+
color?: number[];
|
|
760
|
+
offset?: [number, number];
|
|
761
|
+
outlineColor?: number[];
|
|
762
|
+
};
|
|
763
|
+
type MapLayerConfig = {
|
|
764
|
+
columns?: Record<string, any>;
|
|
765
|
+
color?: number[];
|
|
766
|
+
label?: string;
|
|
767
|
+
dataId: string;
|
|
768
|
+
textLabel: TextLabel[];
|
|
769
|
+
visConfig: VisConfig;
|
|
770
|
+
};
|
|
771
|
+
type MapConfigLayer = {
|
|
772
|
+
type: LayerType;
|
|
773
|
+
id: string;
|
|
774
|
+
config: MapLayerConfig;
|
|
775
|
+
visualChannels: VisualChannels;
|
|
776
|
+
};
|
|
777
|
+
interface CustomStyle {
|
|
778
|
+
url?: string;
|
|
779
|
+
style?: any;
|
|
780
|
+
customAttribution?: string;
|
|
781
|
+
}
|
|
782
|
+
type KeplerMapConfig = {
|
|
783
|
+
filters: any;
|
|
784
|
+
mapState: any;
|
|
785
|
+
mapStyle: {
|
|
786
|
+
styleType: string;
|
|
787
|
+
visibleLayerGroups: Record<string, boolean>;
|
|
788
|
+
};
|
|
789
|
+
popupSettings: any;
|
|
790
|
+
visState: {
|
|
791
|
+
layers: MapConfigLayer[];
|
|
792
|
+
layerBlending: any;
|
|
793
|
+
interactionConfig: any;
|
|
794
|
+
};
|
|
795
|
+
customBaseMaps?: {
|
|
796
|
+
customStyle?: CustomStyle;
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
type BasemapType = 'maplibre' | 'google-maps';
|
|
800
|
+
type Basemap = MapLibreBasemap | GoogleBasemap;
|
|
801
|
+
type BasemapCommon = {
|
|
802
|
+
/**
|
|
803
|
+
* Type of basemap.
|
|
804
|
+
*/
|
|
805
|
+
type: BasemapType;
|
|
806
|
+
/**
|
|
807
|
+
* Custom attribution for style data if not provided by style definition.
|
|
808
|
+
*/
|
|
809
|
+
attribution?: string;
|
|
810
|
+
/**
|
|
811
|
+
* Properties of the basemap. These properties are specific to the basemap type.
|
|
812
|
+
*/
|
|
813
|
+
props: Record<string, any>;
|
|
814
|
+
};
|
|
815
|
+
type MapLibreBasemap = BasemapCommon & {
|
|
816
|
+
type: 'maplibre';
|
|
817
|
+
/**
|
|
818
|
+
* MapLibre map properties.
|
|
819
|
+
*
|
|
820
|
+
* Meant to be passed to directly to `maplibregl.Map` object.
|
|
821
|
+
*/
|
|
822
|
+
props: MapLibreBasemapProps;
|
|
823
|
+
/**
|
|
824
|
+
* Layer groups to be displayed in the basemap.
|
|
825
|
+
*/
|
|
826
|
+
visibleLayerGroups?: Record<string, boolean>;
|
|
827
|
+
/**
|
|
828
|
+
* If `style` has been filtered by `visibleLayerGroups` then this property contains original style object, so user
|
|
829
|
+
* can use `applyLayerGroupFilters` again with new settings.
|
|
830
|
+
*/
|
|
831
|
+
rawStyle?: string | Record<string, any>;
|
|
832
|
+
};
|
|
833
|
+
type MapLibreBasemapProps = {
|
|
834
|
+
style: string | Record<string, any>;
|
|
835
|
+
center: [number, number];
|
|
836
|
+
zoom: number;
|
|
837
|
+
pitch?: number;
|
|
838
|
+
bearing?: number;
|
|
839
|
+
};
|
|
840
|
+
type GoogleBasemap = BasemapCommon & {
|
|
841
|
+
type: 'google-maps';
|
|
842
|
+
/**
|
|
843
|
+
* Google map properties.
|
|
844
|
+
*
|
|
845
|
+
* Meant to be passed to directly to `google.maps.Map` object.
|
|
846
|
+
*/
|
|
847
|
+
props: GoogleBasemapProps;
|
|
848
|
+
};
|
|
849
|
+
type GoogleBasemapProps = {
|
|
850
|
+
mapTypeId: string;
|
|
851
|
+
mapId?: string;
|
|
852
|
+
center?: {
|
|
853
|
+
lat: number;
|
|
854
|
+
lng: number;
|
|
855
|
+
};
|
|
856
|
+
zoom?: number;
|
|
857
|
+
tilt?: number;
|
|
858
|
+
heading?: number;
|
|
859
|
+
};
|
|
860
|
+
type Dataset = {
|
|
861
|
+
id: string;
|
|
862
|
+
type: MapType;
|
|
863
|
+
source: string;
|
|
864
|
+
cache?: number;
|
|
865
|
+
connectionName: string;
|
|
866
|
+
geoColumn: string;
|
|
867
|
+
data: TilejsonResult | GeojsonResult | JsonResult;
|
|
868
|
+
columns: string[];
|
|
869
|
+
format: Format;
|
|
870
|
+
aggregationExp: string;
|
|
871
|
+
aggregationResLevel: number;
|
|
872
|
+
queryParameters: QueryParameters;
|
|
873
|
+
connectionId?: string;
|
|
874
|
+
providerId: ProviderType;
|
|
875
|
+
createdAt?: string;
|
|
876
|
+
updatedAt?: string;
|
|
877
|
+
label?: string;
|
|
878
|
+
color?: string;
|
|
879
|
+
uniqueIdProperty?: string;
|
|
880
|
+
queryTemplate?: string | null;
|
|
881
|
+
name?: string | null;
|
|
882
|
+
spatialIndex?: string | null;
|
|
883
|
+
exportToBucketAvailable?: boolean;
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
declare const _default: {
|
|
887
|
+
readonly VOYAGER: string;
|
|
888
|
+
readonly POSITRON: string;
|
|
889
|
+
readonly DARK_MATTER: string;
|
|
890
|
+
readonly VOYAGER_NOLABELS: string;
|
|
891
|
+
readonly POSITRON_NOLABELS: string;
|
|
892
|
+
readonly DARK_MATTER_NOLABELS: string;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
type LayerDescriptor = {
|
|
896
|
+
type: LayerType;
|
|
897
|
+
props: Record<string, any>;
|
|
898
|
+
filters?: Filters;
|
|
899
|
+
};
|
|
900
|
+
type ParseMapResult = {
|
|
901
|
+
/** Map id. */
|
|
902
|
+
id: string;
|
|
903
|
+
/** Title of map. */
|
|
904
|
+
title: string;
|
|
905
|
+
/** Description of map. */
|
|
906
|
+
description?: string;
|
|
907
|
+
createdAt: string;
|
|
908
|
+
updatedAt: string;
|
|
909
|
+
initialViewState: any;
|
|
910
|
+
/** @deprecated Use `basemap`. */
|
|
911
|
+
mapStyle: any;
|
|
912
|
+
popupSettings: any;
|
|
913
|
+
token: string;
|
|
914
|
+
layers: LayerDescriptor[];
|
|
915
|
+
};
|
|
916
|
+
declare function parseMap(json: any): {
|
|
917
|
+
id: any;
|
|
918
|
+
title: any;
|
|
919
|
+
description: any;
|
|
920
|
+
createdAt: any;
|
|
921
|
+
updatedAt: any;
|
|
922
|
+
initialViewState: any;
|
|
923
|
+
/** @deprecated Use `basemap`. */
|
|
924
|
+
mapStyle: {
|
|
925
|
+
styleType: string;
|
|
926
|
+
visibleLayerGroups: Record<string, boolean>;
|
|
927
|
+
};
|
|
928
|
+
popupSettings: any;
|
|
929
|
+
token: any;
|
|
930
|
+
layers: (LayerDescriptor | undefined)[];
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
type FetchMapOptions = {
|
|
934
|
+
/**
|
|
935
|
+
* CARTO platform access token. Only required for private maps.
|
|
936
|
+
*/
|
|
937
|
+
accessToken?: string;
|
|
938
|
+
/**
|
|
939
|
+
* Base URL of the CARTO Maps API.
|
|
940
|
+
*
|
|
941
|
+
* Example for account located in EU-west region: `https://gcp-eu-west1.api.carto.com`
|
|
942
|
+
*
|
|
943
|
+
* @default https://gcp-us-east1.api.carto.com
|
|
944
|
+
*/
|
|
945
|
+
apiBaseUrl?: string;
|
|
946
|
+
/**
|
|
947
|
+
* Identifier of map created in CARTO Builder.
|
|
948
|
+
*/
|
|
949
|
+
cartoMapId: string;
|
|
950
|
+
clientId?: string;
|
|
951
|
+
/**
|
|
952
|
+
* Custom HTTP headers added to map instantiation and data requests.
|
|
953
|
+
*/
|
|
954
|
+
headers?: Record<string, string>;
|
|
955
|
+
/**
|
|
956
|
+
* Interval in seconds at which to autoRefresh the data. If provided, `onNewData` must also be provided.
|
|
957
|
+
*/
|
|
958
|
+
autoRefresh?: number;
|
|
959
|
+
/**
|
|
960
|
+
* Callback function that will be invoked whenever data in layers is changed. If provided, `autoRefresh` must also be provided.
|
|
961
|
+
*/
|
|
962
|
+
onNewData?: (map: any) => void;
|
|
963
|
+
/**
|
|
964
|
+
* Maximum URL character length. Above this limit, requests use POST.
|
|
965
|
+
* Used to avoid browser and CDN limits.
|
|
966
|
+
* @default {@link DEFAULT_MAX_LENGTH_URL}
|
|
967
|
+
*/
|
|
968
|
+
maxLengthURL?: number;
|
|
969
|
+
};
|
|
970
|
+
type FetchMapResult = ParseMapResult & {
|
|
971
|
+
/**
|
|
972
|
+
* Basemap properties.
|
|
973
|
+
*/
|
|
974
|
+
basemap: Basemap | null;
|
|
975
|
+
stopAutoRefresh?: () => void;
|
|
976
|
+
};
|
|
977
|
+
declare function fetchMap({ accessToken, apiBaseUrl, cartoMapId, clientId, headers, autoRefresh, onNewData, maxLengthURL, }: FetchMapOptions): Promise<FetchMapResult>;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Get basemap properties for Carto map.
|
|
981
|
+
*
|
|
982
|
+
* For maplibre-based basemaps it returns style or style URL that can be used with `maplibregl.Map` compatible component.
|
|
983
|
+
* * style url is returned for non-filtered standard Carto basemaps or if user used style URL directly in configuration
|
|
984
|
+
* * filtered style object returned for Carto basemaps with layer groups filtered
|
|
985
|
+
*
|
|
986
|
+
* For Google-maps base maps, it returns options that can be used with `google.maps.Map` constructor.
|
|
987
|
+
*/
|
|
988
|
+
declare function fetchBasemapProps({ config, errorContext, applyLayerFilters, }: {
|
|
989
|
+
config: KeplerMapConfig;
|
|
990
|
+
/** By default `fetchBasemapProps` applies layers filters to style. Set this to `false` to disable it. */
|
|
991
|
+
applyLayerFilters?: boolean;
|
|
992
|
+
errorContext?: APIErrorContext;
|
|
993
|
+
}): Promise<Basemap | null>;
|
|
994
|
+
|
|
995
|
+
type FilterTypeOptions<T extends FilterType> = {
|
|
996
|
+
type: T;
|
|
997
|
+
column: string;
|
|
998
|
+
} & Filter[T];
|
|
999
|
+
type AddFilterOptions = FilterTypeOptions<FilterType.IN> | FilterTypeOptions<FilterType.BETWEEN> | FilterTypeOptions<FilterType.CLOSED_OPEN> | FilterTypeOptions<FilterType.TIME> | FilterTypeOptions<FilterType.STRING_SEARCH>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Adds a {@link Filter} to the filter set. Any previous filters with the same
|
|
1002
|
+
* `column` and `type` will be replaced.
|
|
1003
|
+
*/
|
|
1004
|
+
declare function addFilter(filters: Record<string, Filter>, { column, type, values, owner }: AddFilterOptions): Record<string, Filter>;
|
|
1005
|
+
type RemoveFilterOptions = {
|
|
1006
|
+
column: string;
|
|
1007
|
+
owner?: string;
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Removes one or more {@link Filter filters} from the filter set. If only
|
|
1011
|
+
* `column` is specified, then all filters on that column are removed. If both
|
|
1012
|
+
* `column` and `owner` are specified, then only filters for that column
|
|
1013
|
+
* associated with the owner are removed.
|
|
1014
|
+
*/
|
|
1015
|
+
declare function removeFilter(filters: Record<string, Filter>, { column, owner }: RemoveFilterOptions): Record<string, Filter>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Clears all {@link Filter filters} from the filter set.
|
|
1018
|
+
*/
|
|
1019
|
+
declare function clearFilters(filters: Record<string, Filter>): Record<string, Filter>;
|
|
1020
|
+
type HasFilterOptions = {
|
|
1021
|
+
column: string;
|
|
1022
|
+
owner?: string;
|
|
1023
|
+
};
|
|
1024
|
+
declare function hasFilter(filters: Record<string, Filter>, { column, owner }: HasFilterOptions): boolean;
|
|
1025
|
+
type GetFilterOptions<T extends FilterType> = {
|
|
1026
|
+
column: string;
|
|
1027
|
+
type: T;
|
|
1028
|
+
owner?: string;
|
|
1029
|
+
};
|
|
1030
|
+
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
1034
|
+
* from deck.gl's `viewport.getBounds()` method ([west, south, east, north]).
|
|
1035
|
+
* If the viewport covers the entire world (to some margin of error in Web
|
|
1036
|
+
* Mercator space), `undefined` is returned instead.
|
|
1037
|
+
*
|
|
1038
|
+
* If the viewport extends beyond longitude range [-180, +180], the polygon
|
|
1039
|
+
* may be reformatted for compatibility with CARTO APIs.
|
|
1040
|
+
*/
|
|
1041
|
+
declare function createViewportSpatialFilter(viewport: BBox): SpatialFilter | undefined;
|
|
1042
|
+
/**
|
|
1043
|
+
* Returns a {@link SpatialFilter} for a given {@link Polygon} or
|
|
1044
|
+
* {@link MultiPolygon}. If the polygon(s) extend outside longitude
|
|
1045
|
+
* range [-180, +180], the result may be reformatted for compatibility
|
|
1046
|
+
* with CARTO APIs.
|
|
1047
|
+
*/
|
|
1048
|
+
declare function createPolygonSpatialFilter(spatialFilter: Polygon | MultiPolygon): SpatialFilter | undefined;
|
|
1049
|
+
|
|
1050
|
+
declare const SOURCE_DEFAULTS: Omit<SourceOptionalOptions, 'clientId'>;
|
|
656
1051
|
|
|
657
1052
|
type BoundaryQuerySourceOptions = SourceOptions & FilterOptions & {
|
|
658
1053
|
columns?: string[];
|
|
@@ -684,8 +1079,6 @@ interface BaseRequestOptions {
|
|
|
684
1079
|
signal?: AbortSignal;
|
|
685
1080
|
spatialFilter?: SpatialFilter;
|
|
686
1081
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
687
|
-
/** Required for table- and query-based spatial index sources (H3, Quadbin). */
|
|
688
|
-
spatialIndexReferenceViewState?: ViewState;
|
|
689
1082
|
/** Overrides source filters, if any. */
|
|
690
1083
|
filters?: Filters;
|
|
691
1084
|
filterOwner?: string;
|
|
@@ -829,26 +1222,6 @@ type TimeSeriesResponse = {
|
|
|
829
1222
|
/** Response from {@link WidgetRemoteSource#getHistogram}. */
|
|
830
1223
|
type HistogramResponse = number[];
|
|
831
1224
|
|
|
832
|
-
interface ModelSource {
|
|
833
|
-
type: MapType;
|
|
834
|
-
apiVersion: ApiVersion;
|
|
835
|
-
apiBaseUrl: string;
|
|
836
|
-
accessToken: string;
|
|
837
|
-
clientId: string;
|
|
838
|
-
connectionName: string;
|
|
839
|
-
data: string;
|
|
840
|
-
filters?: Record<string, Filter>;
|
|
841
|
-
filtersLogicalOperator?: FilterLogicalOperator;
|
|
842
|
-
spatialFilter?: SpatialFilter;
|
|
843
|
-
queryParameters?: QueryParameters;
|
|
844
|
-
spatialDataColumn?: string;
|
|
845
|
-
spatialDataType?: SpatialDataType;
|
|
846
|
-
spatialFiltersResolution?: number;
|
|
847
|
-
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
848
|
-
/** original resolution of the spatial index data as stored in the DW */
|
|
849
|
-
dataResolution?: number;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
1225
|
interface WidgetSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
853
1226
|
apiVersion?: ApiVersion;
|
|
854
1227
|
filters?: Record<string, Filter>;
|
|
@@ -859,7 +1232,7 @@ interface WidgetSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
|
859
1232
|
*
|
|
860
1233
|
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
861
1234
|
*/
|
|
862
|
-
declare abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
1235
|
+
declare abstract class WidgetSource<Props extends WidgetSourceProps = WidgetSourceProps> {
|
|
863
1236
|
readonly props: Props;
|
|
864
1237
|
static defaultProps: Partial<WidgetSourceProps>;
|
|
865
1238
|
constructor(props: Props);
|
|
@@ -871,7 +1244,6 @@ declare abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
|
871
1244
|
* and stability if many (10+) sources are created and not released.
|
|
872
1245
|
*/
|
|
873
1246
|
destroy(): void;
|
|
874
|
-
protected _getSpatialFiltersResolution(source: Omit<ModelSource, 'type' | 'data'>, spatialFilter?: SpatialFilter, referenceViewState?: ViewState): number | undefined;
|
|
875
1247
|
/**
|
|
876
1248
|
* Returns a list of labeled datapoints for categorical data. Suitable for
|
|
877
1249
|
* charts including grouped bar charts, pie charts, and tree charts.
|
|
@@ -919,6 +1291,23 @@ declare abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
|
919
1291
|
abstract getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
920
1292
|
}
|
|
921
1293
|
|
|
1294
|
+
interface ModelSource {
|
|
1295
|
+
type: MapType;
|
|
1296
|
+
apiVersion: ApiVersion;
|
|
1297
|
+
apiBaseUrl: string;
|
|
1298
|
+
accessToken: string;
|
|
1299
|
+
clientId: string;
|
|
1300
|
+
connectionName: string;
|
|
1301
|
+
data: string;
|
|
1302
|
+
filters?: Record<string, Filter>;
|
|
1303
|
+
filtersLogicalOperator?: FilterLogicalOperator;
|
|
1304
|
+
spatialFilter?: SpatialFilter;
|
|
1305
|
+
queryParameters?: QueryParameters;
|
|
1306
|
+
spatialDataColumn?: string;
|
|
1307
|
+
spatialDataType?: SpatialDataType;
|
|
1308
|
+
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
922
1311
|
type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
923
1312
|
/**
|
|
924
1313
|
* Source for Widget API requests.
|
|
@@ -926,9 +1315,6 @@ type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
|
926
1315
|
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
927
1316
|
*/
|
|
928
1317
|
declare abstract class WidgetRemoteSource<Props extends WidgetRemoteSourceProps> extends WidgetSource<Props> {
|
|
929
|
-
protected _headers: Record<string, string>;
|
|
930
|
-
/** Assigns HTTP headers to be included on API requests from this source. */
|
|
931
|
-
setRequestHeaders(headers: Record<string, string>): void;
|
|
932
1318
|
/**
|
|
933
1319
|
* Subclasses of {@link WidgetRemoteSource} must implement this method, calling
|
|
934
1320
|
* {@link WidgetRemoteSource.prototype._getModelSource} for common source
|
|
@@ -977,36 +1363,6 @@ declare class WidgetQuerySource extends WidgetRemoteSource<LayerQuerySourceOptio
|
|
|
977
1363
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
978
1364
|
}
|
|
979
1365
|
|
|
980
|
-
type LayerTableSourceOptions = Omit<VectorTableSourceOptions, 'filters'> | Omit<H3TableSourceOptions, 'filters'> | Omit<QuadbinTableSourceOptions, 'filters'>;
|
|
981
|
-
type WidgetTableSourceResult = {
|
|
982
|
-
widgetSource: WidgetTableSource;
|
|
983
|
-
};
|
|
984
|
-
/**
|
|
985
|
-
* Source for Widget API requests on a data source defined as a table.
|
|
986
|
-
*
|
|
987
|
-
* Generally not intended to be constructed directly. Instead, call
|
|
988
|
-
* {@link vectorTableSource}, {@link h3TableSource}, or {@link quadbinTableSource},
|
|
989
|
-
* which can be shared with map layers. Sources contain a `widgetSource` property,
|
|
990
|
-
* for use by widget implementations.
|
|
991
|
-
*
|
|
992
|
-
* Example:
|
|
993
|
-
*
|
|
994
|
-
* ```javascript
|
|
995
|
-
* import { vectorTableSource } from '@carto/api-client';
|
|
996
|
-
*
|
|
997
|
-
* const data = vectorTableSource({
|
|
998
|
-
* accessToken: '••••',
|
|
999
|
-
* connectionName: 'carto_dw',
|
|
1000
|
-
* tableName: 'carto-demo-data.demo_tables.retail_stores'
|
|
1001
|
-
* });
|
|
1002
|
-
*
|
|
1003
|
-
* const { widgetSource } = await data;
|
|
1004
|
-
* ```
|
|
1005
|
-
*/
|
|
1006
|
-
declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptions & WidgetRemoteSourceProps> {
|
|
1007
|
-
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
1366
|
/**
|
|
1011
1367
|
* @internal
|
|
1012
1368
|
* @privateRemarks Exported for use in @deck.gl/carto's getDataFilterExtensionProps.
|
|
@@ -1046,14 +1402,16 @@ type TileFeatures = {
|
|
|
1046
1402
|
spatialDataColumn?: string;
|
|
1047
1403
|
spatialFilter: SpatialFilter;
|
|
1048
1404
|
uniqueIdProperty?: string;
|
|
1405
|
+
rasterMetadata?: RasterMetadata;
|
|
1049
1406
|
options?: TileFeatureExtractOptions;
|
|
1050
1407
|
};
|
|
1051
1408
|
/** @privateRemarks Source: @carto/react-core */
|
|
1052
1409
|
type TileFeatureExtractOptions = {
|
|
1053
1410
|
storeGeometry?: boolean;
|
|
1411
|
+
uniqueIdProperty?: string;
|
|
1054
1412
|
};
|
|
1055
1413
|
/** @privateRemarks Source: @carto/react-core */
|
|
1056
|
-
declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, options, }: TileFeatures): FeatureData[];
|
|
1414
|
+
declare function tileFeatures({ tiles, spatialFilter, uniqueIdProperty, tileFormat, spatialDataColumn, spatialDataType, rasterMetadata, options, }: TileFeatures): FeatureData[];
|
|
1057
1415
|
|
|
1058
1416
|
declare const FEATURE_GEOM_PROPERTY = "__geomValue";
|
|
1059
1417
|
declare function tileFeaturesGeometries({ tiles, tileFormat, spatialFilter, uniqueIdProperty, options, }: {
|
|
@@ -1159,12 +1517,12 @@ type WidgetTilesetSourceResult = {
|
|
|
1159
1517
|
* const { widgetSource } = await data;
|
|
1160
1518
|
* ```
|
|
1161
1519
|
*/
|
|
1162
|
-
declare class WidgetTilesetSource extends WidgetSource<
|
|
1520
|
+
declare class WidgetTilesetSource<Props extends WidgetTilesetSourceProps = WidgetTilesetSourceProps> extends WidgetSource<Props> {
|
|
1163
1521
|
protected _localImpl: WidgetTilesetSourceImpl | null;
|
|
1164
1522
|
protected _workerImpl: Worker | null;
|
|
1165
1523
|
protected _workerEnabled: boolean;
|
|
1166
1524
|
protected _workerNextRequestId: number;
|
|
1167
|
-
constructor(props:
|
|
1525
|
+
constructor(props: Props);
|
|
1168
1526
|
destroy(): void;
|
|
1169
1527
|
/**
|
|
1170
1528
|
* Returns an initialized Worker, to be reused for the lifecycle of this
|
|
@@ -1200,6 +1558,46 @@ declare class WidgetTilesetSource extends WidgetSource<WidgetTilesetSourceProps>
|
|
|
1200
1558
|
getRange({ signal, ...options }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1201
1559
|
}
|
|
1202
1560
|
|
|
1561
|
+
type WidgetRasterSourceProps = WidgetTilesetSourceProps & {
|
|
1562
|
+
rasterMetadata: RasterMetadata;
|
|
1563
|
+
spatialDataType: 'quadbin';
|
|
1564
|
+
};
|
|
1565
|
+
type WidgetRasterSourceResult = {
|
|
1566
|
+
widgetSource: WidgetRasterSource;
|
|
1567
|
+
};
|
|
1568
|
+
declare class WidgetRasterSource extends WidgetTilesetSource<WidgetRasterSourceProps> {
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
type LayerTableSourceOptions = Omit<VectorTableSourceOptions, 'filters'> | Omit<H3TableSourceOptions, 'filters'> | Omit<QuadbinTableSourceOptions, 'filters'>;
|
|
1572
|
+
type WidgetTableSourceResult = {
|
|
1573
|
+
widgetSource: WidgetTableSource;
|
|
1574
|
+
};
|
|
1575
|
+
/**
|
|
1576
|
+
* Source for Widget API requests on a data source defined as a table.
|
|
1577
|
+
*
|
|
1578
|
+
* Generally not intended to be constructed directly. Instead, call
|
|
1579
|
+
* {@link vectorTableSource}, {@link h3TableSource}, or {@link quadbinTableSource},
|
|
1580
|
+
* which can be shared with map layers. Sources contain a `widgetSource` property,
|
|
1581
|
+
* for use by widget implementations.
|
|
1582
|
+
*
|
|
1583
|
+
* Example:
|
|
1584
|
+
*
|
|
1585
|
+
* ```javascript
|
|
1586
|
+
* import { vectorTableSource } from '@carto/api-client';
|
|
1587
|
+
*
|
|
1588
|
+
* const data = vectorTableSource({
|
|
1589
|
+
* accessToken: '••••',
|
|
1590
|
+
* connectionName: 'carto_dw',
|
|
1591
|
+
* tableName: 'carto-demo-data.demo_tables.retail_stores'
|
|
1592
|
+
* });
|
|
1593
|
+
*
|
|
1594
|
+
* const { widgetSource } = await data;
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptions & WidgetRemoteSourceProps> {
|
|
1598
|
+
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1203
1601
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1204
1602
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1205
1603
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1213,7 +1611,7 @@ type H3TilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
|
|
|
1213
1611
|
declare const h3TilesetSource: (options: H3TilesetSourceOptions) => Promise<H3TilesetSourceResponse>;
|
|
1214
1612
|
|
|
1215
1613
|
type RasterSourceOptions = SourceOptions & TilesetSourceOptions & FilterOptions;
|
|
1216
|
-
type RasterSourceResponse = TilejsonResult;
|
|
1614
|
+
type RasterSourceResponse = TilejsonResult & WidgetRasterSourceResult;
|
|
1217
1615
|
declare const rasterSource: (options: RasterSourceOptions) => Promise<RasterSourceResponse>;
|
|
1218
1616
|
|
|
1219
1617
|
type QuadbinQuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
@@ -1240,63 +1638,12 @@ type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
|
1240
1638
|
type VectorTilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
|
|
1241
1639
|
declare const vectorTilesetSource: (options: VectorTilesetSourceOptions) => Promise<VectorTilesetSourceResponse>;
|
|
1242
1640
|
|
|
1243
|
-
type APIRequestType = 'Map data' | 'Map instantiation' | 'Public map' | 'Tile stats' | 'SQL' | 'Basemap style';
|
|
1244
|
-
type APIErrorContext = {
|
|
1245
|
-
requestType: APIRequestType;
|
|
1246
|
-
mapId?: string;
|
|
1247
|
-
connection?: string;
|
|
1248
|
-
source?: string;
|
|
1249
|
-
type?: MapType;
|
|
1250
|
-
};
|
|
1251
|
-
/**
|
|
1252
|
-
*
|
|
1253
|
-
* Custom error for reported errors in CARTO Maps API.
|
|
1254
|
-
* Provides useful debugging information in console and context for applications.
|
|
1255
|
-
*
|
|
1256
|
-
*/
|
|
1257
|
-
declare class CartoAPIError extends Error {
|
|
1258
|
-
/** Source error from server */
|
|
1259
|
-
error: Error;
|
|
1260
|
-
/** Context (API call & parameters) in which error occured */
|
|
1261
|
-
errorContext: APIErrorContext;
|
|
1262
|
-
/** Response from server */
|
|
1263
|
-
response?: Response;
|
|
1264
|
-
/** JSON Response from server */
|
|
1265
|
-
responseJson?: any;
|
|
1266
|
-
constructor(error: Error, errorContext: APIErrorContext, response?: Response, responseJson?: any);
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
/** @internal Required by fetchMap(). */
|
|
1270
|
-
declare function buildPublicMapUrl({ apiBaseUrl, cartoMapId, }: {
|
|
1271
|
-
apiBaseUrl: string;
|
|
1272
|
-
cartoMapId: string;
|
|
1273
|
-
}): string;
|
|
1274
|
-
/** @internal Required by fetchMap(). */
|
|
1275
|
-
declare function buildStatsUrl({ attribute, apiBaseUrl, connectionName, source, type, }: {
|
|
1276
|
-
attribute: string;
|
|
1277
|
-
apiBaseUrl: string;
|
|
1278
|
-
connectionName: string;
|
|
1279
|
-
source: string;
|
|
1280
|
-
type: MapType;
|
|
1281
|
-
}): string;
|
|
1282
|
-
|
|
1283
|
-
type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
1284
|
-
declare const query: (options: QueryOptions) => Promise<QueryResult>;
|
|
1285
|
-
|
|
1286
|
-
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache, }: {
|
|
1287
|
-
baseUrl: string;
|
|
1288
|
-
parameters?: Record<string, unknown>;
|
|
1289
|
-
headers?: Record<string, string>;
|
|
1290
|
-
errorContext: APIErrorContext;
|
|
1291
|
-
maxLengthURL?: number;
|
|
1292
|
-
localCache?: LocalCacheOptions;
|
|
1293
|
-
}): Promise<T>;
|
|
1294
|
-
|
|
1295
1641
|
/**
|
|
1296
1642
|
* Resolution conversion function. Takes a WebMercatorViewport and returns
|
|
1297
1643
|
* a H3 resolution such that the screen space size of the hexagons is
|
|
1298
1644
|
* "similar" to the given tileSize on screen. Intended for use with deck.gl.
|
|
1299
1645
|
* @internal
|
|
1646
|
+
* @privateRemarks Source: https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
|
|
1300
1647
|
*/
|
|
1301
1648
|
declare function _getHexagonResolution(viewport: {
|
|
1302
1649
|
zoom: number;
|
|
@@ -1388,4 +1735,4 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1388
1735
|
*/
|
|
1389
1736
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1390
1737
|
|
|
1391
|
-
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GeojsonResult, type GetFilterOptions, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type JsonResult, type MapType, type NamedQueryParameter, type PositionalQueryParameter, Provider, 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 RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RemoveFilterOptions, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptions, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type TilejsonResult, type TilesetSourceOptions, 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, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, createPolygonSpatialFilter, createViewportSpatialFilter, filterFunctions, geojsonFeatures, getClient, getDataFilterExtensionProps, getFilter, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1738
|
+
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, 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, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GeojsonResult, 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 JsonResult, type KeplerMapConfig, 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 RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptions, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type TilejsonResult, type TilesetSourceOptions, 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, clearFilters, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getClient, getColorAccessor, getColorValueAccessor, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|