or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

3d-tiles.mdcore-math-geometry.mddata-sources.mdentity-data-visualization.mdimagery-terrain.mdindex.mdscene-3d-graphics.mdtime-animation.mdviewer-widgets.md
tile.json

data-sources.mddocs/

Data Sources and File Formats

Data source classes for loading and visualizing various geospatial file formats including GeoJSON, CZML, KML, and GPX.

Capabilities

Base Data Source

Core data source interface and functionality.

/**
 * Base interface for data sources
 */
interface DataSource {
  readonly name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  
  update(time: JulianDate): boolean;
}

/**
 * Custom data source for programmatically created entities
 */
class CustomDataSource {
  constructor(name?: string);
  name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  
  update(time: JulianDate): boolean;
}

/**
 * Collection of data sources
 */
class DataSourceCollection {
  readonly length: number;
  readonly dataSourceAdded: Event;
  readonly dataSourceRemoved: Event;
  readonly dataSourceMoved: Event;
  
  add(dataSource: DataSource | Promise<DataSource>): Promise<DataSource>;
  remove(dataSource: DataSource, destroy?: boolean): boolean;
  removeAll(destroy?: boolean): void;
  contains(dataSource: DataSource): boolean;
  indexOf(dataSource: DataSource): number;
  get(index: number): DataSource;
  getByName(name: string): DataSource[];
  raise(dataSource: DataSource): void;
  lower(dataSource: DataSource): void;
  raiseToTop(dataSource: DataSource): void;
  lowerToBottom(dataSource: DataSource): void;
  isDestroyed(): boolean;
  destroy(): void;
}

/**
 * Clock configuration for data sources
 */
class DataSourceClock {
  constructor();
  startTime?: JulianDate;
  stopTime?: JulianDate;
  currentTime?: JulianDate;
  clockRange?: ClockRange;
  clockStep?: ClockStep;
  multiplier?: number;
  
  getValue(): Clock;
  merge(source: DataSourceClock): void;
  clone(result?: DataSourceClock): DataSourceClock;
  equals(other: DataSourceClock): boolean;
}

/**
 * Display manager for data sources in a scene
 */
class DataSourceDisplay {
  constructor(options: DataSourceDisplayOptions);
  readonly scene: Scene;
  readonly dataSources: DataSourceCollection;
  readonly defaultDataSource: CustomDataSource;
  static defaultVisualizersCallback: DataSourceDisplay.VisualizersCallback;
  
  isDestroyed(): boolean;
  destroy(): void;
  update(time: JulianDate): boolean;
}

interface DataSourceDisplayOptions {
  scene: Scene;
  dataSourceCollection: DataSourceCollection;
  visualizersCallback?: DataSourceDisplay.VisualizersCallback;
}

GeoJSON Data Source

Loading and visualizing GeoJSON geospatial data.

/**
 * Data source for GeoJSON files and objects
 */
class GeoJsonDataSource {
  constructor(name?: string);
  name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  credit?: Credit;
  
  static load(data: Resource | string | object, options?: GeoJsonDataSourceOptions): Promise<GeoJsonDataSource>;
  static crsNames: any;
  static crsLinkHrefs: any;
  static crsLinkTypes: any;
  
  load(data: Resource | string | object, options?: GeoJsonDataSourceOptions): Promise<GeoJsonDataSource>;
  update(time: JulianDate): boolean;
}

interface GeoJsonDataSourceOptions {
  sourceUri?: string;
  geojsonOptions?: any;
  describe?: GeoJsonDataSource.describe;
  markerSize?: number;
  markerSymbol?: string;
  markerColor?: Color;
  stroke?: Color;
  strokeWidth?: number;
  fill?: Color;
  clampToGround?: boolean;
  credit?: Credit | string;
}

namespace GeoJsonDataSource {
  type describe = (properties: any, nameProperty: string) => BillboardGraphics | LabelGraphics | PointGraphics | PolylineGraphics | PolygonGraphics;
  
  function fill(entity: Entity, style: any): void;
  function stroke(entity: Entity, style: any): void;
  function markerSize(entity: Entity, style: any): void;
  function markerSymbol(entity: Entity, style: any): void;
  function markerColor(entity: Entity, style: any): void;
}

CZML Data Source

Time-dynamic visualization using CZML format.

/**
 * Data source for CZML (Cesium Language) files
 */
class CzmlDataSource {
  constructor(name?: string);
  name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  credit?: Credit;
  
  static load(czml: Resource | string | object[], options?: CzmlDataSourceOptions): Promise<CzmlDataSource>;
  static processPacketData(type: Function, object: any, propertyName: string, packetData: any, interval: TimeInterval, sourceUri?: string, entityCollection?: EntityCollection): void;
  static processPositionPacketData(object: any, propertyName: string, packetData: any, interval: TimeInterval, sourceUri?: string, entityCollection?: EntityCollection): void;
  static processMaterialPacketData(object: any, propertyName: string, packetData: any, interval: TimeInterval, sourceUri?: string, entityCollection?: EntityCollection): void;
  static updaters: CzmlDataSource.Updater[];
  
  load(czml: Resource | string | object[], options?: CzmlDataSourceOptions): Promise<CzmlDataSource>;
  process(czml: Resource | string | object[], options?: CzmlDataSourceOptions): Promise<CzmlDataSource>;
  update(time: JulianDate): boolean;
}

interface CzmlDataSourceOptions {
  sourceUri?: string;
  credit?: Credit | string;
}

namespace CzmlDataSource {
  interface Updater {
    (entity: Entity, packet: any, entityCollection: EntityCollection, sourceUri?: string): void;
  }
}

KML Data Source

Google Earth KML/KMZ file support.

/**
 * Data source for KML and KMZ files
 */
class KmlDataSource {
  constructor(options?: KmlDataSourceOptions);
  name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  credit?: Credit;
  readonly refreshEvent: Event;
  readonly unsupportedNodeEvent: Event;
  
  static load(data: Resource | string | Document | Blob, options?: KmlDataSourceLoadOptions): Promise<KmlDataSource>;
  
  load(data: Resource | string | Document | Blob, options?: KmlDataSourceLoadOptions): Promise<KmlDataSource>;
  update(time: JulianDate): boolean;
}

interface KmlDataSourceOptions {
  camera?: Camera;
  canvas?: HTMLCanvasElement;
  sourceUri?: string;
  clampToGround?: boolean;
  ellipsoid?: Ellipsoid;
  credit?: Credit | string;
}

interface KmlDataSourceLoadOptions {
  camera?: Camera;
  canvas?: HTMLCanvasElement;
  sourceUri?: string;
  clampToGround?: boolean;
  ellipsoid?: Ellipsoid;
  screenOverlayContainer?: Element;
  credit?: Credit | string;
}

/**
 * Individual KML feature within a data source
 */
class KmlFeatureData {
  readonly author: { name?: string; uri?: string; email?: string };
  readonly link: { href?: string; hreflang?: string; rel?: string; type?: string; title?: string; length?: string };
  readonly address?: string;
  readonly phoneNumber?: string;
  readonly snippet?: string;
  readonly extendedData?: string;
}

/**
 * Camera view for KML features
 */
class KmlCamera {
  constructor(options: KmlCameraOptions);
  position: Cartesian3;
  headingPitchRoll: HeadingPitchRoll;
}

interface KmlCameraOptions {
  position: Cartesian3;
  headingPitchRoll: HeadingPitchRoll;
}

/**
 * Look-at view for KML features  
 */
class KmlLookAt {
  constructor(options: KmlLookAtOptions);
  position: Cartesian3;
  headingPitchRange: HeadingPitchRange;
}

interface KmlLookAtOptions {
  position: Cartesian3;
  headingPitchRange: HeadingPitchRange;
}

/**
 * KML tour for animated presentations
 */
class KmlTour {
  constructor(name: string, id: string);
  readonly name: string;
  readonly id: string;
  readonly playlist: KmlTourFlyTo[];
  
  addPlaylistEntry(entry: KmlTourFlyTo): void;
  play(viewer: Viewer, cameraOptions?: any): void;
  stop(): void;
}

/**
 * KML tour fly-to entry
 */
class KmlTourFlyTo {
  constructor(duration: number, flyToMode: string, view: KmlCamera | KmlLookAt);
  readonly duration: number;
  readonly flyToMode: string;
  readonly view: KmlCamera | KmlLookAt;
  
  play(done: KmlTourFlyTo.DoneCallback, camera: Camera, cameraOptions?: any): void;
  stop(): void;
}

namespace KmlTourFlyTo {
  type DoneCallback = () => void;
}

/**
 * KML tour wait entry
 */
class KmlTourWait {
  constructor(duration: number);
  readonly duration: number;
  
  play(done: KmlTourWait.DoneCallback): void;
  stop(): void;
}

namespace KmlTourWait {
  type DoneCallback = () => void;
}

GPX Data Source

GPS Exchange Format support for tracks and waypoints.

/**
 * Data source for GPX files
 */
class GpxDataSource {
  constructor(name?: string);
  name: string;
  readonly clock?: DataSourceClock;
  readonly entities: EntityCollection;
  readonly isLoading: boolean;
  readonly changedEvent: Event;
  readonly errorEvent: Event;
  readonly loadingEvent: Event;
  show: boolean;
  clustering: EntityCluster;
  credit?: Credit;
  
  static load(data: Resource | string | Document | Blob, options?: GpxDataSourceOptions): Promise<GpxDataSource>;
  
  load(data: Resource | string | Document | Blob, options?: GpxDataSourceOptions): Promise<GpxDataSource>;
  update(time: JulianDate): boolean;
}

interface GpxDataSourceOptions {
  sourceUri?: string;
  clampToGround?: boolean;
  ellipsoid?: Ellipsoid;
  credit?: Credit | string;
}

File Format Loaders

Lower-level loaders for specific file formats.

/**
 * Loader for 3D model formats (glTF, etc.)
 */
class ModelExperimental {
  constructor(options: ModelExperimentalOptions);
  readonly boundingSphere: BoundingSphere;
  readonly ready: boolean;
  readonly readyPromise: Promise<ModelExperimental>;
  readonly activeAnimations: ModelAnimationCollection;
  readonly featureIdLabel: string;
  readonly instanceFeatureIdLabel: string;
  readonly featureTableId: number;
  show: boolean;
  modelMatrix: Matrix4;
  scale: number;
  minimumPixelSize: number;
  maximumScale?: number;
  id?: any;
  allowPicking: boolean;
  clampAnimations: boolean;
  shadows: ShadowMode;
  heightReference: HeightReference;
  scene?: Scene;
  distanceDisplayCondition?: DistanceDisplayCondition;
  color?: Color;
  colorBlendMode: ColorBlendMode;
  colorBlendAmount: number;
  silhouetteColor?: Color;
  silhouetteSize: number;
  clippingPlanes?: ClippingPlaneCollection;
  dequantizeInShader: boolean;
  imageBasedLightingFactor: Cartesian2;
  lightColor?: Cartesian3;
  luminanceAtZenith: number;
  sphericalHarmonicCoefficients?: Cartesian3[];
  specularEnvironmentMaps?: string;
  credit?: Credit;
  showCreditsOnScreen: boolean;
  splitDirection: SplitDirection;
  debugShowBoundingVolume: boolean;
  debugWireframe: boolean;
  
  static fromGltf(options: ModelExperimentalFromGltfOptions): ModelExperimental;
  static silhouetteSupported(scene: Scene): boolean;
  
  update(frameState: FrameState): void;
  isDestroyed(): boolean;
  destroy(): void;
  getNode(name: string): ModelNode;
  getMesh(name: string): ModelMesh;
  getMaterial(name: string): ModelMaterial;
  setArticulationStage(articulationStageKey: string, value: number): void;
  getArticulationStage(articulationStageKey: string): number;
}

interface ModelExperimentalOptions {
  url?: Resource | string;
  basePath?: Resource | string;
  show?: boolean;
  modelMatrix?: Matrix4;
  scale?: number;
  minimumPixelSize?: number;
  maximumScale?: number;
  id?: any;
  allowPicking?: boolean;
  clampAnimations?: boolean;
  shadows?: ShadowMode;
  heightReference?: HeightReference;
  scene?: Scene;
  distanceDisplayCondition?: DistanceDisplayCondition;
  color?: Color;
  colorBlendMode?: ColorBlendMode;
  colorBlendAmount?: number;
  silhouetteColor?: Color;
  silhouetteSize?: number;
  clippingPlanes?: ClippingPlaneCollection;
  dequantizeInShader?: boolean;
  imageBasedLightingFactor?: Cartesian2;
  lightColor?: Cartesian3;
  luminanceAtZenith?: number;
  sphericalHarmonicCoefficients?: Cartesian3[];
  specularEnvironmentMaps?: string;
  credit?: Credit | string;
  showCreditsOnScreen?: boolean;
  splitDirection?: SplitDirection;
  debugShowBoundingVolume?: boolean;
  debugWireframe?: boolean;
}

interface ModelExperimentalFromGltfOptions {
  gltf: any;
  basePath?: Resource | string;
  show?: boolean;
  modelMatrix?: Matrix4;
  scale?: number;
  minimumPixelSize?: number;
  maximumScale?: number;
  id?: any;
  allowPicking?: boolean;
  clampAnimations?: boolean;
  shadows?: ShadowMode;
  heightReference?: HeightReference;
  scene?: Scene;
  distanceDisplayCondition?: DistanceDisplayCondition;
  color?: Color;
  colorBlendMode?: ColorBlendMode;
  colorBlendAmount?: number;
  silhouetteColor?: Color;
  silhouetteSize?: number;
  clippingPlanes?: ClippingPlaneCollection;
  dequantizeInShader?: boolean;
  imageBasedLightingFactor?: Cartesian2;
  lightColor?: Cartesian3;
  luminanceAtZenith?: number;
  sphericalHarmonicCoefficients?: Cartesian3[];
  specularEnvironmentMaps?: string;
  credit?: Credit | string;
  showCreditsOnScreen?: boolean;
  splitDirection?: SplitDirection;
  debugShowBoundingVolume?: boolean;
  debugWireframe?: boolean;
}

/**
 * glTF loader for 3D models
 */
class GltfLoader {
  constructor(options: GltfLoaderOptions);
  readonly promise: Promise<GltfLoader>;
  readonly gltf: any;
  readonly texturesByName: { [key: string]: Texture };
  readonly vertexArrays: { [key: string]: VertexArray };
  
  load(): Promise<GltfLoader>;
  process(frameState: FrameState): void;
  isDestroyed(): boolean;
  destroy(): void;
}

interface GltfLoaderOptions {
  gltfJson: any;
  bufferViewLoader?: BufferViewLoader;
  baseUri?: string;
  byteOffset?: number;
  releaseGltfJson?: boolean;
  asynchronous?: boolean;
  incrementallyLoadTextures?: boolean;
  upAxis?: Axis;
  forwardAxis?: Axis;
  loadAttributesFor2D?: boolean;
  enablePick?: boolean;
  loadIndicesForWireframe?: boolean;
  loadPrimitiveOutline?: boolean;
}

/**
 * I3S (Indexed 3D Scene Layer) data source
 */
class I3SDataProvider {
  constructor(options: I3SDataProviderOptions);
  readonly name: string;
  readonly url: string;
  readonly data: I3SLayer;
  readonly ready: boolean;
  readonly readyPromise: Promise<I3SDataProvider>;
  show: boolean;
  
  static fromUrl(url: Resource | string, options?: I3SDataProviderFromUrlOptions): Promise<I3SDataProvider>;
  
  isDestroyed(): boolean;
  destroy(): void;
}

interface I3SDataProviderOptions {
  name?: string;
  data: I3SLayer;
  show?: boolean;
}

interface I3SDataProviderFromUrlOptions {
  name?: string;
  show?: boolean;
  geoidTiledTerrainProvider?: CesiumTerrainProvider;
}

/**
 * Point cloud data source for LAS/LAZ files
 */
class PointCloudShading {
  constructor(options?: PointCloudShadingOptions);
  attenuation: boolean;
  geometricErrorScale: number;
  maximumAttenuation?: number;
  baseResolution?: number;
  eyeDomeLighting: boolean;
  eyeDomeLightingStrength: number;
  eyeDomeLightingRadius: number;
  backFaceCulling: boolean;
  normalShading: boolean;
}

interface PointCloudShadingOptions {
  attenuation?: boolean;
  geometricErrorScale?: number;
  maximumAttenuation?: number;
  baseResolution?: number;
  eyeDomeLighting?: boolean;
  eyeDomeLightingStrength?: number;
  eyeDomeLightingRadius?: number;
  backFaceCulling?: boolean;
  normalShading?: boolean;
}

Visualization Processors

Processing utilities for converting data formats to visual entities.

/**
 * Visualizer for billboard graphics
 */
class BillboardVisualizer {
  constructor(entityCluster: EntityCluster, entityCollection: EntityCollection);
  readonly entityCollection: EntityCollection;
  
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

/**
 * Visualizer for label graphics
 */
class LabelVisualizer {
  constructor(entityCluster: EntityCluster, entityCollection: EntityCollection);
  readonly entityCollection: EntityCollection;
  
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

/**
 * Visualizer for model graphics
 */
class ModelVisualizer {
  constructor(scene: Scene, entityCollection: EntityCollection);
  readonly entityCollection: EntityCollection;
  
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

/**
 * Visualizer for point graphics
 */
class PointVisualizer {
  constructor(entityCluster: EntityCluster, entityCollection: EntityCollection);
  readonly entityCollection: EntityCollection;
  
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

/**
 * Visualizer for polyline graphics
 */
class PolylineVisualizer {
  constructor(scene: Scene, entityCollection: EntityCollection, primitives?: PrimitiveCollection, groundPrimitives?: PrimitiveCollection);
  readonly entityCollection: EntityCollection;
  
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

Types

namespace DataSourceDisplay {
  type VisualizersCallback = (scene: Scene, entityCluster: EntityCluster, dataSource: DataSource) => Visualizer[];
}

interface Visualizer {
  update(time: JulianDate): boolean;
  getBoundingSphere(entity: Entity, result: BoundingSphere): BoundingSphere;
  isDestroyed(): boolean;
  destroy(): void;
}

enum ColorBlendMode {
  HIGHLIGHT = 0,
  REPLACE = 1,
  MIX = 2
}

enum ClockRange {
  UNBOUNDED = 0,
  CLAMPED = 1,
  LOOP_STOP = 2
}

enum ClockStep {
  TICK_DEPENDENT = 0,
  SYSTEM_CLOCK_MULTIPLIER = 1,
  SYSTEM_CLOCK = 2
}

enum Axis {
  X = 0,
  Y = 1,
  Z = 2
}

interface I3SLayer {
  readonly version: string;
  readonly id: number;
  readonly name: string;
  readonly href: string;
  readonly layerType: string;
  readonly spatialReference: I3SSpatialReference;
  readonly heightModelInfo: I3SHeightModelInfo;
}

interface I3SSpatialReference {
  readonly wkid?: number;
  readonly latestWkid?: number;
  readonly vcsWkid?: number;
  readonly latestVcsWkid?: number;
}

interface I3SHeightModelInfo {
  readonly heightModel: string;
  readonly vertCRS: string;
  readonly heightUnit: string;
}

interface BufferViewLoader {
  load(): Promise<BufferViewLoader>;
  typedArray: Uint8Array;
}

interface ModelNode {
  readonly name: string;
  readonly id: number;
  readonly show: boolean;
  readonly matrix: Matrix4;
  readonly originalMatrix: Matrix4;
  
  setTransform(transform: Matrix4): void;
  getTransform(): Matrix4;
}

interface ModelMesh {
  readonly name: string;
  readonly id: number;
  readonly materials: ModelMaterial[];
}

interface ModelMaterial {
  readonly name: string;
  readonly id: number;
}

interface ModelAnimationCollection {
  readonly length: number;
  
  add(options: ModelAnimationOptions): ModelAnimation;
  addAll(options?: ModelAnimationCollectionOptions): ModelAnimation[];
  remove(animation: ModelAnimation): boolean;
  removeAll(): void;
  contains(animation: ModelAnimation): boolean;
  get(index: number): ModelAnimation;
}

interface ModelAnimation {
  readonly name: string;
  readonly startTime: JulianDate;
  readonly delay: number;
  readonly stopTime: JulianDate;
  readonly removeOnStop: boolean;
  multiplier: number;
  reverse: boolean;
  
  start(options?: ModelAnimationStartOptions): void;
  stop(): void;
}

interface ModelAnimationOptions {
  name?: string;
  startTime?: JulianDate;
  delay?: number;
  stopTime?: JulianDate;
  removeOnStop?: boolean;
  multiplier?: number;
  reverse?: boolean;
}

interface ModelAnimationCollectionOptions {
  multiplier?: number;
  reverse?: boolean;
  loop?: ModelAnimationLoop;
}

interface ModelAnimationStartOptions {
  speedup?: number;
  slowdown?: number;
}

enum ModelAnimationLoop {
  NONE = 0,
  REPEAT = 1,
  MIRRORED_REPEAT = 2
}

interface HeadingPitchRoll {
  heading: number;
  pitch: number;
  roll: number;
}

interface ClippingPlaneCollection {
  readonly length: number;
  modelMatrix: Matrix4;
  unionClippingRegions: boolean;
  enabled: boolean;
  edgeColor: Color;
  edgeWidth: number;
  
  add(plane: ClippingPlane): ClippingPlane;
  get(index: number): ClippingPlane;
  contains(plane: ClippingPlane): boolean;
  remove(plane: ClippingPlane): boolean;
  removeAll(): void;
}

interface ClippingPlane {
  normal: Cartesian3;
  distance: number;
}