kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
88 lines (87 loc) • 3.32 kB
TypeScript
import { TileJSON } from '@loaders.gl/mvt';
import { PMTilesMetadata } from '@loaders.gl/pmtiles';
import { PMTilesType, RemoteTileFormat } from '@kepler.gl/constants';
import { KeplerLayer } from '@kepler.gl/types';
import { FilterProps, default as KeplerDataset } from '../kepler-table';
export declare function isTileDataset(dataset: KeplerDataset | {
type: string;
}): boolean;
declare type VectorTileField = {
analyzerType: string;
name: string;
id: string;
format: string;
type: string;
filterProps?: FilterProps;
};
export declare type VectorTileMetadata = {
attributions?: unknown[];
metaJson: any | null;
bounds: number[] | null;
center: number[] | null;
maxZoom: number | null;
minZoom: number | null;
name?: string;
description?: string;
fields: VectorTileField[];
pmtilesType?: PMTilesType;
};
declare type TilesetMetadata = VectorTileMetadata;
export declare type TippecanoeLayerAttribute = {
attribute?: string;
type?: string;
min?: number;
max?: number;
values: string[] | number[];
};
/**
* Normalize tile URL
* @param {string} tileUrl Initial tile URL, which may be either the root URL for the
* tileset or a fully qualified template
* @param {function} validateUrl function to validate tile URL
* @return {string|null} Fully qualified tile URL template, or null if input does not
* appear to be a valid URL
*/
export declare function getTileUrl(tileUrl: string, validateUrl?: (s: string) => boolean): string | null;
/**
* Get the metadata URL for a given tileset
*/
export declare function getMetaUrl(tileUrl: string): string | null;
declare type ParseMetadataOption = {
tileUrl?: string | null;
};
/**
* Parse the metadata for a given tileset
*/
export declare function parseVectorMetadata(metadata: PMTilesMetadata | TileJSON, option?: ParseMetadataOption): TilesetMetadata | null;
export declare type FieldIndexBy = {
format: string;
type: string;
mappedValue: {
[key: string]: string;
};
};
export declare function getFilterProps(fieldType: string, attribute: TippecanoeLayerAttribute): FilterProps;
/**
* Returns true if a dataset can be used as source data for a layer.
* @param dataset A dataset.
* @param layer A layer.
* @returns Returns true if a dataset can be used as source data for a layer.
*/
export declare function matchDatasetType(dataset: KeplerDataset, layer: KeplerLayer): boolean;
declare type GetFieldsFromTileProps = {
remoteTileFormat: RemoteTileFormat;
tilesetUrl: string | null;
metadataUrl: string | null;
metadata: VectorTileMetadata | null;
};
/**
* Extracts fields from a tile and updates the metadata object with found fields.
* Note: this function is for tilesets that don't include fields in metadata (most likely saved with older spec.).
* @param params.remoteTileFormat The format of the remote tile (MVT or PMTiles).
* @param params.tilesetUrl The URL of the tileset.
* @param params.metadataUrl The URL of the metadata.
* @param params.metadata The metadata object containing fields and tile properties.
*/
export declare const getFieldsFromTile: ({ remoteTileFormat, tilesetUrl, metadataUrl, metadata }: GetFieldsFromTileProps) => Promise<void>;
export {};