kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
96 lines (95 loc) • 4.22 kB
TypeScript
import { Layer as DeckLayer, LayerProps as DeckLayerProps } from '@deck.gl/core/typed';
import { Field, TooltipField, CompareType, SplitMapLayers, InteractionConfig, Editor, Feature, FeatureSelectionContext, Viewport } from '@kepler.gl/types';
import { Layer, LayerClassesType } from '@kepler.gl/layers';
import KeplerTable, { Datasets } from '@kepler.gl/table';
import { VisState } from '@kepler.gl/schemas';
import { DataRow } from '@kepler.gl/utils';
export declare type LayersToRender = {
[layerId: string]: boolean;
};
export declare type AggregationLayerHoverData = {
points: any[];
colorValue?: any;
elevationValue?: any;
};
export declare type LayerHoverProp = {
data: DataRow | AggregationLayerHoverData | null;
fields: Field[];
fieldsToShow: TooltipField[];
layer: Layer;
primaryData?: DataRow | AggregationLayerHoverData | null;
compareType?: CompareType;
};
/**
* Find default layers from fields
*/
export declare function findDefaultLayer(dataset: KeplerTable, layerClasses: LayerClassesType): Layer[];
declare type MinVisStateForLayerData = {
datasets: VisState['datasets'];
animationConfig: VisState['animationConfig'];
};
/**
* Calculate layer data based on layer type, col Config,
* return updated layer if colorDomain, dataMap has changed.
* Also, returns updated layer in case the input layer was in invalid state.
* Adds an error message to the layer in case of an exception.
*/
export declare function calculateLayerData<S extends MinVisStateForLayerData>(layer: Layer, state: S, oldLayerData?: any): {
layerData: any;
layer: Layer;
};
/**
* Calculate props passed to LayerHoverInfo
* @type {typeof import('./layer-utils').getLayerHoverProp}
*/
export declare function getLayerHoverProp({ interactionConfig, hoverInfo, layers, layersToRender, datasets }: {
interactionConfig: InteractionConfig;
hoverInfo: any;
layers: Layer[];
layersToRender: LayersToRender;
datasets: Datasets;
}): LayerHoverProp | null;
export declare function renderDeckGlLayer(props: any, layerCallbacks: {
[key: string]: any;
}): any;
export declare function isLayerRenderable(layer: Layer, layerData: any): boolean;
export declare function isLayerVisible(layer: any, mapLayers: any): any;
export declare function prepareLayersForDeck(layers: Layer[], layerData: VisState['layerData']): {
[key: string]: boolean;
};
export declare function prepareLayersToRender(layers: Layer[], layerData: VisState['layerData'], mapLayers?: SplitMapLayers | undefined | null): LayersToRender;
declare type CustomDeckLayer = DeckLayer<DeckLayerProps>;
export declare function getCustomDeckLayers(deckGlProps?: any): [CustomDeckLayer[], CustomDeckLayer[]];
export declare type ComputeDeckLayersProps = {
mapIndex?: number;
mapboxApiAccessToken?: string;
mapboxApiUrl?: string;
primaryMap?: boolean;
layersForDeck?: {
[key: string]: boolean;
};
editorInfo?: {
editor: Editor;
editorMenuActive: boolean;
onSetFeatures: (features: Feature[]) => any;
setSelectedFeature: (feature: Feature | null, selectionContext?: FeatureSelectionContext) => any;
featureCollection: {
type: string;
features: Feature[];
};
selectedFeatureIndexes: number[];
viewport: Viewport;
};
};
export declare function bindLayerCallbacks(layerCallbacks: LayerCallbacks | undefined, idx: number): Record<string, (_idx: number, val: any) => void>;
export declare type LayerCallbacks = {
onLayerHover?: (idx: number, value: any) => void;
onSetLayerDomain?: (idx: number, value: any) => void;
};
export declare function computeDeckLayers({ visState, mapState, mapStyle }: any, options?: ComputeDeckLayersProps, layerCallbacks?: LayerCallbacks, deckGlProps?: any): Layer[];
export declare function getLayerOrderFromLayers<T extends {
id: string;
}>(layers: T[]): string[];
export declare function reorderLayerOrder(layerOrder: VisState['layerOrder'], originLayerId: string, destinationLayerId: string): VisState['layerOrder'];
export declare function addLayerToLayerOrder(layerOrder: VisState['layerOrder'], layerId: string): string[];
export {};