kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
163 lines (162 loc) • 8.32 kB
TypeScript
import { FeatureCollection, Feature } from 'geojson';
import { Layer as DeckLayer } from '@deck.gl/core/typed';
import { _Tile2DHeader as Tile2DHeader } from '@deck.gl/geo-layers/typed';
import { GeoJsonLayer } from '@deck.gl/layers/typed';
import { MVTTileSource } from '@loaders.gl/mvt';
import { PMTilesTileSource } from '@loaders.gl/pmtiles';
import { DatasetType } from '@kepler.gl/constants';
import { KeplerTable as KeplerDataset, Datasets as KeplerDatasets, GpuFilter } from '@kepler.gl/table';
import { AnimationConfig, Field as KeplerField, LayerColorConfig, LayerHeightConfig, Merge, MapState, BindedLayerCallbacks, VisConfigRange, VisConfigNumber, DomainStops } from '@kepler.gl/types';
import { DataContainerInterface } from '@kepler.gl/utils';
import { default as KeplerLayer, LayerBaseConfig, LayerBaseConfigPartial, VisualChannel, VisualChannelDomain, VisualChannelField } from '../base-layer';
import { FindDefaultLayerPropsReturnValue } from '../layer-utils';
import AbstractTileLayer, { LayerData as CommonLayerData, AbstractTileLayerConfig, AbstractTileLayerVisConfigSettings } from './abstract-tile-layer';
import TileDataset from './common-tile/tile-dataset';
export declare const DEFAULT_HIGHLIGHT_FILL_COLOR: number[];
export declare const DEFAULT_HIGHLIGHT_STROKE_COLOR: number[];
export declare const MAX_CACHE_SIZE_MOBILE = 1;
export declare const DEFAULT_STROKE_WIDTH = 1;
/**
* Type for transformRequest returned parameters.
*/
export declare type RequestParameters = {
/** The URL to be requested. */
url: string;
/** Search parameters to be added onto the URL. */
searchParams: URLSearchParams;
/** Options passed to fetch. */
options: RequestInit;
};
declare type TileContent = (FeatureCollection & {
shape: 'geojson-table';
}) | (Feature[] & {
shape: undefined;
});
declare type VectorTile = Tile2DHeader<TileContent>;
declare type LayerData = CommonLayerData & {
tilesetDataUrl?: string | null;
tileSource: MVTTileSource | PMTilesTileSource | null;
};
declare type VectorTileLayerRenderOptions = Merge<{
idx: number;
visible: boolean;
mapState: MapState;
data: any;
animationConfig: AnimationConfig;
gpuFilter: GpuFilter;
layerCallbacks: BindedLayerCallbacks;
objectHovered: {
index: number;
tile: VectorTile;
sourceLayer: typeof GeoJsonLayer;
};
}, LayerData>;
export declare const vectorTileVisConfigs: {
stroked: {
defaultValue: boolean;
label: string | ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => string);
group: string | number | symbol;
property: string;
description?: string | undefined;
condition?: ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => boolean) | undefined;
allowCustomValue?: boolean | undefined;
type: "boolean";
};
strokeColorScale: any;
strokeColorRange: "strokeColorRange";
sizeRange: "strokeWidthRange";
strokeWidth: {
property: string;
defaultValue: number;
allowCustomValue: boolean;
label: string | ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => string);
group: string | number | symbol;
description?: string | undefined;
condition?: ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => boolean) | undefined;
type: "number";
isRanged: false;
range: import("@kepler.gl/types").SizeRange;
step: number;
};
radiusScale: any;
radiusRange: VisConfigRange;
strokeColor: "strokeColor";
strokeOpacity: {
property: string;
label: string | ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => string);
group: string | number | symbol;
description?: string | undefined;
condition?: ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => boolean) | undefined;
allowCustomValue?: boolean | undefined;
type: "number";
isRanged: false;
defaultValue: number;
range: import("@kepler.gl/types").SizeRange;
step: number;
};
radius: VisConfigNumber;
radiusUnits: import("@kepler.gl/types").VisConfigBoolean;
enable3d: "enable3d";
transition: import("@kepler.gl/types").VisConfigBoolean;
heightRange: "elevationRange";
elevationScale: {
allowCustomValue: boolean;
label: string | ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => string);
group: string | number | symbol;
property: string;
description?: string | undefined;
condition?: ((config: LayerBaseConfig & Partial<LayerColorConfig> & Partial<LayerHeightConfig> & Partial<import("@kepler.gl/types").LayerSizeConfig> & Partial<import("@kepler.gl/types").LayerWeightConfig>) => boolean) | undefined;
type: "number";
isRanged: false;
defaultValue: number;
range: import("@kepler.gl/types").SizeRange;
step: number;
};
opacity: "opacity";
colorRange: "colorRange";
radiusByZoom: any;
dynamicColor: import("@kepler.gl/types").VisConfigBoolean;
};
export declare type VectorTileLayerConfig = Merge<AbstractTileLayerConfig, {
sizeField?: VisualChannelField;
sizeScale?: string;
sizeDomain?: VisualChannelDomain;
strokeColorField: VisualChannelField;
radiusField?: VisualChannelField;
radiusScale?: string;
radiusDomain?: VisualChannelDomain;
radiusRange?: any;
}>;
export declare type VectorTileLayerVisConfigSettings = Merge<AbstractTileLayerVisConfigSettings, {
sizeRange: VisConfigRange;
strokeWidth: VisConfigNumber;
}>;
export declare function tileLayerBoundsLayer(id: string, props: {
bounds?: number[];
}): DeckLayer[];
export default class VectorTileLayer extends AbstractTileLayer<VectorTile, Feature[]> {
config: VectorTileLayerConfig;
visConfigSettings: VectorTileLayerVisConfigSettings;
constructor(props: ConstructorParameters<typeof AbstractTileLayer>[0]);
meta: {};
static findDefaultLayerProps(dataset: KeplerDataset): FindDefaultLayerPropsReturnValue;
initTileDataset(): TileDataset<VectorTile, Feature[]>;
get type(): "vectorTile";
get name(): string;
get layerIcon(): KeplerLayer['layerIcon'];
get supportedDatasetTypes(): DatasetType[];
get visualChannels(): Record<string, VisualChannel>;
getDefaultLayerConfig(props: LayerBaseConfigPartial): LayerBaseConfig & Partial<LayerColorConfig & LayerHeightConfig>;
getHoverData(object: {
properties?: Record<string, Record<string, unknown>>;
}, dataContainer: DataContainerInterface, fields: KeplerField[]): (Record<string, unknown> | null)[];
calculateLayerDomain(dataset: KeplerDataset, visualChannel: VisualChannel): DomainStops | number[];
getScaleOptions(channelKey: string): string[];
accessRowValue(field?: KeplerField, indexKey?: number | null): (field: KeplerField, datum: Feature) => number | null;
updateLayerMeta(dataset: KeplerDataset, datasets: KeplerDatasets): void;
formatLayerData(datasets: KeplerDatasets, oldLayerData: unknown, animationConfig: AnimationConfig): LayerData;
hasHoveredObject(objectInfo: any): any;
renderSubLayers(props: Record<string, any>): DeckLayer | DeckLayer[];
renderLayer(opts: VectorTileLayerRenderOptions): DeckLayer[];
}
export {};