Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
import {SavedMap, ParsedConfig, SavedConfigV1, MinSavedConfigV1} from './schemas';
import type {LayerVisConfig} from './layers';
import type {ViewportPadding} from './reducers';
/** EXPORT_FILE_TO_CLOUD */
export type MapData = {
map: SavedMap;
thumbnail: Blob | null;
};
export type ExportFileOptions = {
isPublic?: boolean;
overwrite?: boolean;
mapIdToOverwrite?: string | null;
/** Download name, without extension. Separate from the map title. */
fileName?: string;
};
export type OnErrorCallBack = (error: Error) => any;
export type OnSuccessCallBack = (p: {
response: any;
provider: Provider;
options: ExportFileOptions;
}) => any;
export type ExportFileToCloudPayload = {
mapData: MapData;
provider: Provider;
options: ExportFileOptions;
onSuccess?: OnSuccessCallBack;
onError?: OnErrorCallBack;
closeModal?: boolean;
};
/**
* Input dataset parsed to addDataToMap
*/
export type ProtoDatasetField = {
name: string;
type: string;
format?: string;
displayName?: string;
analyzerType?: string;
id?: string;
metadata?: Record<string, any>;
};
export type GeoArrowBinaryData = Record<
number,
Record<
number,
{
binaryGeometries: any[];
bounds: [number, number, number, number];
featureTypes: {point: boolean; line: boolean; polygon: boolean};
meanCenters?: Array<number[] | null>;
}
>
>;
export type ProtoDataset = {
info: {
id?: string;
label?: string;
format?: string;
color?: RGBColor;
type?: string;
hidden?: boolean;
};
data: {
fields: ProtoDatasetField[];
rows: any[][];
cols?: any[];
arrowTable?: arrow.Table;
/** GeoArrow chunks already converted to deck.gl binary features on workers. */
geoArrowBinaryData?: GeoArrowBinaryData;
/** Existing table in the configured DuckDB database; avoids re-importing its rows. */
duckdbTableName?: string;
};
// table-injected metadata
metadata?: any;
supportedFilterTypes?: string[] | null;
disableDataOperation?: boolean;
};
export type AddDataToMapOptions = {
centerMap?: boolean;
/**
* Padding in pixels applied when `centerMap` is true.
* Use this so a few points are not hidden under the side panel or other UI.
* A number applies the same padding on all sides.
*/
padding?: ViewportPadding;
readOnly?: boolean;
keepExistingConfig?: boolean;
autoCreateLayers?: boolean;
autoCreateTooltips?: boolean;
layerVisConfig?: Partial<LayerVisConfig>;
};
export type AddDataToMapPayload = {
// TODO/ib - internally the code calls `toArray` a couple of layers deep
// so this function can actually accept both an array and an object
// recommend dropping such "sloppy typing" and enforcing array type
// as the field is called `datasets`
datasets: ProtoDataset[] | ProtoDataset;
options?: AddDataToMapOptions;
config?: ParsedConfig | SavedConfigV1 | MinSavedConfigV1;
info?: Partial<MapInfo>;
};