Skip to content

CZMLPlugin

CZMLPlugin shows CZML documents whose shapes stay in place while their style or their visibility changes over time: extruded polygons whose height and color are sampled, polylines whose color is sampled, and polygons, polylines, labels, points and billboards shown only during the availability of their packet.

load() reads a document, adds its polygons, polylines, labels, points and billboards as layers, and returns a CZMLDocument, which keeps the document’s clock. While the document plays, each value moves from one sample to the next as a transition blended on the GPU. Its features are evaluated again only when the playback passes a sample time or the start or stop of an availability, and when it is paused, moved or changes speed.

Only part of CZML is supported. See Supported CZML.

import ThreeView from "@navaramap/three";
import { DefaultPlugin } from "@navaramap/three-default-plugin";
import { CZMLPlugin } from "@navaramap/three-plugins";
const view = new ThreeView({ container });
const czml = new CZMLPlugin();
view.addPlugin(new DefaultPlugin());
view.addPlugin(czml);
await view.init();
// Polygons are shaded by the scene lights
view.atmosphere.date = new Date("2026-07-16T03:00:00Z");
view.addLight({ ambient: { intensity: 0.6 } });
view.addLight({ sun: { intensity: 1.8 } });
const doc = await czml.load({ url: "https://example.com/population.czml" });
// Play one hour of the document per second
doc.play({ speed: 60 * 60 });
CZMLShown as
polygon with an extrudedHeight, constant or sampledA polygon extruded from the ellipsoid up to extrudedHeight
polygon with perPositionHeightA polygon at the heights of its positions
polygon with perPositionHeight and an extrudedHeightA polygon filled from a flat bottom at extrudedHeight up to the heights of its positions
polylineA polyline at the heights of its positions
polyline with clampToGroundA polyline draped on the surface
label with a constant positionA text label at the height of its position, in a registered font
point with a constant positionA circle at the height of its position, pixelSize across
billboard with a constant position and imageThe image at the height of its position, facing the screen
material.solidColor.color as rgba or rgbaf, constant or sampledColor and opacity. An unset material is opaque white
availability of one intervalThe packet is hidden outside the interval
clock of the document packetCZMLDocument.clock

Positions are constant, given as cartographicDegrees or cartographicRadians. Polygons can have holes.

Supported CZML lists the status of every packet property, graphics type and graphics property, together with what is left out with a console warning.

  • API: the methods and properties of CZMLPlugin and CZMLDocument
  • Showing CZML: labels, points and billboards, flood polygons and how the shapes are drawn
  • FeatureEvaluator: the transitions the plugin plays the samples with
  • Supported CZML: the status of every CZML property
  • Layer: the handles in CZMLDocument.layers
  • three_flood_mesh: flood simulations played with a continuous water surface
  • About three_plugins: Package overview