UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

837 lines (836 loc) 23.1 kB
import { scaleLinear, scaleQuantize, scaleQuantile, scaleOrdinal, scaleSqrt, scaleLog, scalePoint } from 'd3-scale'; import { RGBAColor, EffectDescription, BaseMapStyle } from '@kepler.gl/types'; export declare const ACTION_PREFIX = "@@kepler.gl/"; export declare const KEPLER_UNFOLDED_BUCKET = "https://studio-public-data.foursquare.com/statics/keplergl"; export declare const BASEMAP_ICON_PREFIX: string; export declare const DEFAULT_MAPBOX_API_URL = "https://api.mapbox.com"; export declare const TRANSITION_DURATION = 0; /** * Modal id: data table * @constant * @type {string} * @public */ export declare const DATA_TABLE_ID = "dataTable"; /** * Modal id: delete dataset confirm dialog * @constant * @type {string} * @public */ export declare const DELETE_DATA_ID = "deleteData"; /** * Modal id: add data modal * @constant * @type {string} * @public */ export declare const ADD_DATA_ID = "addData"; /** * Modal id: export image modal * @constant * @type {string} * @public */ export declare const EXPORT_IMAGE_ID = "exportImage"; /** * Modal id: export data modal * @constant * @type {string} * @public */ export declare const EXPORT_DATA_ID = "exportData"; /** * Modal id: add custom map style modal * @constant * @type {string} * @public */ export declare const ADD_MAP_STYLE_ID = "addMapStyle"; /** * Modal id: export map modal * @constant * @type {string} * @public */ export declare const EXPORT_MAP_ID = "exportMap"; /** * Modal id: save map modal * @constant * @type {string} * @public */ export declare const SAVE_MAP_ID = "saveMap"; /** * Modal id: confirm to overwrite saved map * @constant * @type {string} * @public */ export declare const OVERWRITE_MAP_ID = "overwriteMap"; /** * Modal id: share map url modal * @constant * @type {string} * @public */ export declare const SHARE_MAP_ID = "shareMap"; export declare const KEPLER_GL_NAME = "kepler.gl"; export declare const KEPLER_GL_VERSION = "__PACKAGE_VERSION__"; export declare const KEPLER_GL_WEBSITE = "http://kepler.gl/"; export declare const DIMENSIONS: { sidePanel: { width: number; margin: { top: number; left: number; bottom: number; right: number; }; headerHeight: number; }; mapControl: { width: number; padding: number; mapLegend: { pinned: { bottom: number; right: number; }; }; }; }; /** * Theme name that can be passed to `KeplerGl` `prop.theme`. * Available themes are `THEME.light` and `THEME.dark`. Default theme is `THEME.dark` * @constant * @type {object} * @public * @example * ```js * const Map = () => <KeplerGl theme={THEME.light} id="map"/> * ``` */ export declare const THEME: { light: "light"; dark: "dark"; base: "base"; }; export declare const SIDEBAR_PANELS: { id: string; label: string; onClick: null; }[]; export declare const PANEL_VIEW_TOGGLES: { list: "list"; byDataset: "byDataset"; }; export declare const PANELS: { id: string; label: string; onClick: null; }[]; export declare const DEFAULT_BLDG_COLOR = "#D1CEC7"; export declare const DEFAULT_BACKGROUND_COLOR = "#000000"; export declare const BASE_MAP_BACKGROUND_LAYER_IDS: string[]; export declare const BACKGROUND_LAYER_GROUP_SLUG = "Background"; export declare const THREE_D_BUILDING_LAYER_GROUP_SLUG = "3d building"; export declare type DEFAULT_LAYER_GROUP = { slug: string; filter: (value: any) => boolean; defaultVisibility: boolean; isVisibilityToggleAvailable?: boolean; isMoveToTopAvailable?: boolean; isColorPickerAvailable?: boolean; }; export declare const BACKGROUND_LAYER_GROUP: DEFAULT_LAYER_GROUP; export declare const DEFAULT_LAYER_GROUPS: DEFAULT_LAYER_GROUP[]; export declare const BASE_MAP_COLOR_MODES: { NONE: "NONE"; DARK: "DARK"; LIGHT: "LIGHT"; }; export declare const NO_MAP_ID = "no_map"; export declare const EMPTY_MAPBOX_STYLE: { version: number; sources: {}; layers: never[]; }; export declare const NO_BASEMAP_ICON: string; export declare const DEFAULT_MAP_STYLES: BaseMapStyle[]; export declare const GEOJSON_FIELDS: { geojson: string[]; }; export declare const ICON_FIELDS: { icon: string[]; }; export declare const TRIP_POINT_FIELDS: [string, string][]; export declare const ALTITUDE_FIELDS: string[]; export declare const TRIP_ARC_FIELDS: { lat0: string; lng0: string; lat1: string; lng1: string; }; export declare const FILTER_TYPES: { range: "range"; select: "select"; input: "input"; timeRange: "timeRange"; multiSelect: "multiSelect"; polygon: "polygon"; }; export declare const FILTER_VIEW_TYPES: { side: "side"; enlarged: "enlarged"; minified: "minified"; }; export declare const DEFAULT_FILTER_VIEW_TYPE: "side"; export declare const SCALE_TYPES: { ordinal: "ordinal"; quantile: "quantile"; quantize: "quantize"; linear: "linear"; sqrt: "sqrt"; log: "log"; point: "point"; }; export declare const SCALE_FUNC: { linear: typeof scaleLinear; quantize: typeof scaleQuantize; quantile: typeof scaleQuantile; ordinal: typeof scaleOrdinal; sqrt: typeof scaleSqrt; log: typeof scaleLog; point: typeof scalePoint; }; export declare const ALL_FIELD_TYPES: { boolean: "boolean"; date: "date"; geojson: "geojson"; integer: "integer"; real: "real"; string: "string"; timestamp: "timestamp"; point: "point"; array: "array"; object: "object"; geoarrow: "geoarrow"; }; export declare const SORT_ORDER: { ASCENDING: "ASCENDING"; DESCENDING: "DESCENDING"; UNSORT: "UNSORT"; }; export declare const TABLE_OPTION: { SORT_ASC: "SORT_ASC"; SORT_DES: "SORT_DES"; UNSORT: "UNSORT"; PIN: "PIN"; UNPIN: "UNPIN"; COPY: "COPY"; FORMAT_COLUMN: "FORMAT_COLUMN"; }; export declare const TABLE_OPTION_LIST: ({ value: "SORT_ASC"; display: string; icon: string; condition: (props: any) => boolean; } | { value: "SORT_DES"; display: string; icon: string; condition: (props: any) => boolean; } | { value: "UNSORT"; display: string; icon: string; condition: (props: any) => any; } | { value: "PIN"; display: string; icon: string; condition: (props: any) => boolean; } | { value: "UNPIN"; display: string; icon: string; condition: (props: any) => any; } | { value: "COPY"; display: string; icon: string; condition?: undefined; } | { value: "FORMAT_COLUMN"; display: string; icon: string; condition?: undefined; })[]; export declare const FIELD_TYPE_DISPLAY: { boolean: { label: string; color: string; }; date: { label: string; color: string; }; geojson: { label: string; color: string; }; geoarrow: { label: string; color: string; }; integer: { label: string; color: string; }; real: { label: string; color: string; }; string: { label: string; color: string; }; timestamp: { label: string; color: string; }; point: { label: string; color: string; }; array: { label: string; color: string; }; object: { label: string; color: string; }; }; export declare const FIELD_COLORS: { default: string; }; export declare const HIGHLIGH_COLOR_3D: RGBAColor; export declare const CHANNEL_SCALES: { color: "color"; radius: "radius"; size: "size"; colorAggr: "colorAggr"; sizeAggr: "sizeAggr"; }; export declare const AGGREGATION_TYPES: { count: 'count'; average: 'average'; maximum: 'maximum'; minimum: 'minimum'; median: 'median'; stdev: 'stdev'; sum: 'sum'; variance: 'variance'; mode: 'mode'; countUnique: 'countUnique'; }; export declare const AGGREGATION_TYPE_OPTIONS: { id: string; label: string; }[]; export declare const linearFieldScaleFunctions: { color: ("quantile" | "quantize")[]; radius: "sqrt"[]; size: ("log" | "linear" | "sqrt")[]; }; export declare const linearFieldAggrScaleFunctions: { colorAggr: { average: ("quantile" | "quantize")[]; maximum: ("quantile" | "quantize")[]; minimum: ("quantile" | "quantize")[]; median: ("quantile" | "quantize")[]; stdev: ("quantile" | "quantize")[]; sum: ("quantile" | "quantize")[]; variance: ("quantile" | "quantize")[]; }; sizeAggr: { average: ("log" | "linear" | "sqrt")[]; maximum: ("log" | "linear" | "sqrt")[]; minimum: ("log" | "linear" | "sqrt")[]; median: ("log" | "linear" | "sqrt")[]; stdev: ("log" | "linear" | "sqrt")[]; sum: ("log" | "linear" | "sqrt")[]; variance: ("log" | "linear" | "sqrt")[]; }; }; export declare const ordinalFieldScaleFunctions: { color: "ordinal"[]; radius: "point"[]; size: "point"[]; }; export declare const ordinalFieldAggrScaleFunctions: { colorAggr: { mode: "ordinal"[]; countUnique: ("quantile" | "quantize")[]; }; sizeAggr: {}; }; export declare const notSupportedScaleOpts: { color: never[]; radius: never[]; size: never[]; }; export declare const notSupportAggrOpts: { colorAggr: {}; sizeAggr: {}; }; /** * Default aggregation are based on ocunt */ export declare const DEFAULT_AGGREGATION: { colorAggr: { count: ("quantile" | "quantize")[]; }; sizeAggr: { count: ("log" | "linear" | "sqrt")[]; }; }; /** * Define what type of scale operation is allowed on each type of fields */ export declare const FIELD_OPTS: { string: { type: string; scale: { colorAggr: { mode: "ordinal"[]; countUnique: ("quantile" | "quantize")[]; }; sizeAggr: {}; color: "ordinal"[]; radius: "point"[]; size: "point"[]; }; format: { legend: (d: any) => any; tooltip: never[]; }; }; real: { type: string; scale: { colorAggr: { average: ("quantile" | "quantize")[]; maximum: ("quantile" | "quantize")[]; minimum: ("quantile" | "quantize")[]; median: ("quantile" | "quantize")[]; stdev: ("quantile" | "quantize")[]; sum: ("quantile" | "quantize")[]; variance: ("quantile" | "quantize")[]; }; sizeAggr: { average: ("log" | "linear" | "sqrt")[]; maximum: ("log" | "linear" | "sqrt")[]; minimum: ("log" | "linear" | "sqrt")[]; median: ("log" | "linear" | "sqrt")[]; stdev: ("log" | "linear" | "sqrt")[]; sum: ("log" | "linear" | "sqrt")[]; variance: ("log" | "linear" | "sqrt")[]; }; color: ("quantile" | "quantize")[]; radius: "sqrt"[]; size: ("log" | "linear" | "sqrt")[]; }; format: { legend: (d: any) => any; tooltip: string[]; }; }; timestamp: { type: string; scale: { colorAggr: {}; sizeAggr: {}; color: ("quantile" | "quantize")[]; radius: "sqrt"[]; size: ("log" | "linear" | "sqrt")[]; }; format: { legend: (d: any) => any; tooltip: string[]; }; }; integer: { type: string; scale: { colorAggr: { average: ("quantile" | "quantize")[]; maximum: ("quantile" | "quantize")[]; minimum: ("quantile" | "quantize")[]; median: ("quantile" | "quantize")[]; stdev: ("quantile" | "quantize")[]; sum: ("quantile" | "quantize")[]; variance: ("quantile" | "quantize")[]; }; sizeAggr: { average: ("log" | "linear" | "sqrt")[]; maximum: ("log" | "linear" | "sqrt")[]; minimum: ("log" | "linear" | "sqrt")[]; median: ("log" | "linear" | "sqrt")[]; stdev: ("log" | "linear" | "sqrt")[]; sum: ("log" | "linear" | "sqrt")[]; variance: ("log" | "linear" | "sqrt")[]; }; color: ("quantile" | "quantize")[]; radius: "sqrt"[]; size: ("log" | "linear" | "sqrt")[]; }; format: { legend: (d: any) => any; tooltip: string[]; }; }; boolean: { type: string; scale: { colorAggr: { mode: "ordinal"[]; countUnique: ("quantile" | "quantize")[]; }; sizeAggr: {}; color: "ordinal"[]; radius: "point"[]; size: "point"[]; }; format: { legend: (d: any) => any; tooltip: string[]; }; }; date: { type: string; scale: { colorAggr: { mode: "ordinal"[]; countUnique: ("quantile" | "quantize")[]; }; sizeAggr: {}; color: "ordinal"[]; radius: "point"[]; size: "point"[]; }; format: { legend: (d: any) => any; tooltip: string[]; }; }; geojson: { type: string; scale: { colorAggr: {}; sizeAggr: {}; color: never[]; radius: never[]; size: never[]; }; format: { legend: (d: any) => string; tooltip: never[]; }; }; geoarrow: { type: string; scale: { colorAggr: {}; sizeAggr: {}; color: never[]; radius: never[]; size: never[]; }; format: { legend: (d: any) => string; tooltip: never[]; }; }; object: { type: string; scale: {}; format: { legend: (d: any) => string; tooltip: never[]; }; }; array: { type: string; scale: {}; format: { legend: (d: any) => string; tooltip: never[]; }; }; }; export declare const CHANNEL_SCALE_SUPPORTED_FIELDS: { [id: string]: string[]; }; export declare const DEFAULT_LAYER_COLOR: { tripArc: string; begintrip_lat: string; dropoff_lat: string; request_lat: string; }; export declare const DEFAULT_TOOLTIP_FIELDS: any[]; export declare const NO_VALUE_COLOR: RGBAColor; export declare const DEFAULT_PICKING_RADIUS = 3; export declare const OVERLAY_BLENDINGS: { normal: { label: string; value: string; }; screen: { label: string; value: string; }; darken: { label: string; value: string; }; }; export declare const LAYER_BLENDINGS: { additive: { label: string; blendFunc: string[]; blendEquation: string; }; normal: { label: string; blendFunc: string[]; blendEquation: string[]; }; subtractive: { label: string; blendFunc: string[]; blendEquation: string[]; }; }; export declare const MAX_DEFAULT_TOOLTIPS = 5; export declare const RESOLUTIONS: { ONE_X: "ONE_X"; TWO_X: "TWO_X"; }; export declare const EXPORT_IMG_RATIOS: { SCREEN: "SCREEN"; FOUR_BY_THREE: "FOUR_BY_THREE"; SIXTEEN_BY_NINE: "SIXTEEN_BY_NINE"; CUSTOM: "CUSTOM"; }; export declare type ExportImage = { ratio: keyof typeof EXPORT_IMG_RATIOS; resolution: keyof typeof RESOLUTIONS; legend: boolean; mapH: number; mapW: number; imageSize: { zoomOffset: number; scale: number; imageW: number; imageH: number; }; imageDataUri: string; exporting: boolean; processing: boolean; error: Error | false; escapeXhtmlForWebpack?: boolean; center: boolean; }; export declare type ImageRatioOption = { id: keyof typeof EXPORT_IMG_RATIOS; label: string; hidden?: boolean; getSize: (screenW: number, screenH: number) => { width: number; height: number; }; }; export declare const ScreenRatioOption: ImageRatioOption; export declare const CustomRatioOption: ImageRatioOption; export declare const FourByThreeRatioOption: ImageRatioOption; export declare const SixteenByNineRatioOption: ImageRatioOption; export declare const EXPORT_IMG_RATIO_OPTIONS: ReadonlyArray<ImageRatioOption>; export declare type ImageResolutionOption = { id: keyof typeof RESOLUTIONS; label: string; available: boolean; scale: number; getSize: (screenW: number, screenH: number) => { width: number; height: number; }; }; export declare const OneXResolutionOption: ImageResolutionOption; export declare const TwoXResolutionOption: ImageResolutionOption; export declare const EXPORT_IMG_RESOLUTION_OPTIONS: ReadonlyArray<ImageResolutionOption>; export declare const EXPORT_DATA_TYPE: { CSV: "CSV"; }; export declare const EXPORT_DATA_TYPE_OPTIONS: { id: "CSV"; label: string; available: boolean; }[]; export declare const EXPORT_MAP_FORMATS: { HTML: "HTML"; JSON: "JSON"; }; export declare const EXPORT_HTML_MAP_MODES: { READ: "READ"; EDIT: "EDIT"; }; export declare const EXPORT_MAP_FORMAT_OPTIONS: { id: string; label: any; available: boolean; }[]; export declare function getHTMLMapModeTileUrl(mode: string): string; export declare const EXPORT_HTML_MAP_MODE_OPTIONS: { id: string; label: string; available: boolean; url: string; }[]; export declare const DEFAULT_UUID_COUNT = 6; export declare const DEFAULT_NOTIFICATION_MESSAGE = "MESSAGE_NOT_PROVIDED"; export declare const DEFAULT_NOTIFICATION_TYPES: { info: "info"; error: "error"; warning: "warning"; success: "success"; }; export declare const DEFAULT_NOTIFICATION_TOPICS: { global: "global"; file: "file"; }; export declare const THROTTLE_NOTIFICATION_TIME = 330; export declare const BASE_SPEED = 600; export declare const FPS = 60; /** * 4 Animation Window Types * 1. free * |-> |-> * Current time is a fixed range, animation controller calls next animation frames continuously to animation a moving window * The increment id based on domain / BASE_SPEED * SPEED * * 2. incremental * | |-> * Same as free, current time is a growing range, only the max value of range increment during animation. * The increment is also based on domain / BASE_SPEED * SPEED * * 3. point * o -> o * Current time is a point, animation controller calls next animation frame continuously to animation a moving point * The increment is based on domain / BASE_SPEED * SPEED * * 4. interval * o ~> o * Current time is a point. An array of sorted time steps need to be provided. * animation controller calls next animation at a interval when the point jumps to the next step */ export declare const ANIMATION_WINDOW: { free: "free"; incremental: "incremental"; point: "point"; interval: "interval"; }; export declare const DEFAULT_TIME_FORMAT = "MM/DD/YY HH:mm:ssa"; export declare const SPEED_CONTROL_RANGE: [number, number]; export declare const SPEED_CONTROL_STEP = 0.001; export declare const GEOCODER_DATASET_NAME = "geocoder_dataset"; export declare const GEOCODER_LAYER_ID = "geocoder_layer"; export declare const GEOCODER_GEO_OFFSET = 0.05; export declare const GEOCODER_ICON_COLOR: [number, number, number]; export declare const GEOCODER_ICON_SIZE = 80; export declare const EDITOR_LAYER_ID = "kepler_editor_layer"; export declare const EDITOR_LAYER_PICKING_RADIUS = 6; export declare const EDITOR_MODES: { DRAW_POLYGON: string; DRAW_RECTANGLE: string; EDIT: string; }; export declare const PLOT_TYPES: { histogram: "histogram"; lineChart: "lineChart"; }; export declare const INIT_FILTER_ITEMS_IN_DROPDOWN = 100; /** * Max number of filter value buffers that deck.gl provides */ export declare const MAX_GPU_FILTERS = 4; export declare const MAP_THUMBNAIL_DIMENSION: { width: number; height: number; }; export declare const MAP_INFO_CHARACTER: { title: number; description: number; }; export declare const LOADING_METHODS: { upload: "upload"; storage: "storage"; }; export declare const DEFAULT_FEATURE_FLAGS: {}; export declare const DATASET_FORMATS: { row: "row"; geojson: "geojson"; csv: "csv"; keplergl: "keplergl"; arrow: "arrow"; }; export declare const MAP_CONTROLS: { visibleLayers: "visibleLayers"; mapLegend: "mapLegend"; toggle3d: "toggle3d"; splitMap: "splitMap"; mapDraw: "mapDraw"; mapLocale: "mapLocale"; effect: "effect"; }; /** * A multiplier for screen-space width/scale for Arc, Line, Icon and Text layers. * Required in order to maintain the same appearance after upgrading to deck.gl v8.5. * https://github.com/visgl/deck.gl/blob/master/docs/upgrade-guide.md */ export declare const PROJECTED_PIXEL_SIZE_MULTIPLIER: number; /** * Maximum value for text outline width */ export declare const TEXT_OUTLINE_MULTIPLIER = 5; export declare const dataTestIds: Record<string, string>; export declare const DEFAULT_TIMEZONE = "UTC"; export declare const DEFAULT_POST_PROCESSING_EFFECT_TYPE: string; export declare const DEFAULT_LIGHT_COLOR: [number, number, number]; export declare const DEFAULT_LIGHT_INTENSITY = 1; export declare const DEFAULT_SHADOW_INTENSITY = 0.5; export declare const DEFAULT_SHADOW_COLOR: [number, number, number]; export declare const LIGHT_AND_SHADOW_EFFECT_TIME_MODES: { pick: "pick"; current: "current"; animation: "animation"; }; export declare type LightAndShadowEffectTimeMode = 'pick' | 'current' | 'animation'; export declare const DEFAULT_LIGHT_AND_SHADOW_PROPS: { timestamp: number; timeMode: LightAndShadowEffectTimeMode; shadowIntensity: number; shadowColor: [number, number, number]; sunLightColor: [number, number, number]; sunLightIntensity: number; ambientLightColor: [number, number, number]; ambientLightIntensity: number; }; export declare const LIGHT_AND_SHADOW_EFFECT: EffectDescription; export declare const POSTPROCESSING_EFFECTS: { [key: string]: EffectDescription; }; export declare const EFFECT_DESCRIPTIONS: EffectDescription[]; export declare type EffectType = 'ink' | 'brightnessContrast' | 'hueSaturation' | 'vibrance' | 'sepia' | 'dotScreen' | 'colorHalftone' | 'noise' | 'triangleBlur' | 'zoomBlur' | 'tiltShift' | 'edgeWork' | 'vignette' | 'magnify' | 'hexagonalPixelate' | 'lightAndShadow';