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 {
AnnotationKind,
AnnotationTextSide,
AnnotationTextVerticalPosition
} from '@kepler.gl/constants';
export {AnnotationKind} from '@kepler.gl/constants';
export {isAnnotationKind, isAnnotationWithArm} from '@kepler.gl/constants';
export type BaseAnnotation = {
id: string;
kind: AnnotationKind;
isVisible: boolean;
autoSize: boolean;
autoSizeY: boolean;
/** [lng, lat] or [lng, lat, altitudeMeters]. Missing altitude is treated as 0. */
anchorPoint: [number, number] | [number, number, number];
label: string;
editorState?: Record<string, any>;
mapIndex?: number;
lineColor: string;
lineWidth: number;
textWidth: number;
textHeight: number;
textVerticalAlign?: 'top' | 'middle' | 'bottom';
textSide?: AnnotationTextSide;
textVerticalPosition?: AnnotationTextVerticalPosition;
};
export type AnnotationWithArm = BaseAnnotation & {
armLength: number;
angle: number;
};
export type TextAnnotation = BaseAnnotation & {
kind: AnnotationKind.TEXT;
};
export type PointAnnotation = AnnotationWithArm & {
kind: AnnotationKind.POINT;
};
export type ArrowAnnotation = AnnotationWithArm & {
kind: AnnotationKind.ARROW;
};
export type CircleAnnotation = AnnotationWithArm & {
kind: AnnotationKind.CIRCLE;
radiusInMeters: number;
};
export type RulerAnnotation = BaseAnnotation & {
kind: AnnotationKind.RULER;
/** Second [lng, lat] or [lng, lat, altitudeMeters] endpoint. */
endPoint: [number, number] | [number, number, number];
/** Whether the user-authored rich text is rendered at the ruler midpoint. */
showCustomText: boolean;
/** Whether the computed geodesic length is rendered at the ruler midpoint. */
showDistance: boolean;
};
export type Annotation =
| TextAnnotation
| PointAnnotation
| ArrowAnnotation
| CircleAnnotation
| RulerAnnotation;
export type AnnotationPropsPartial = Partial<Annotation>;