Skip to content

Showing CZML

A CZML label names its font with a CSS font such as "16pt Lucida Console". The plugin takes the size and the first family from it, and uses the family as the font of the label’s layer. Register a font family under that name with view.addFontFamily() before calling load(). A family that is not registered is fetched as the URL of a font file, which fails with a console warning and leaves the labels undrawn.

import { fetchFontFamilyFromCss } from "@navaramap/three";
// The font the labels of the document are drawn in, registered under the
// family name the document uses
view.addFontFamily(
await fetchFontFamilyFromCss(
"Lucida Console",
"https://fonts.googleapis.com/css2?family=Noto+Sans+JP",
),
);
const doc = await czml.load({ url: "https://example.com/routes.czml" });

The weight and style of the CSS font are not applied: they are those of the registered font files. pixelOffset, horizontalOrigin and verticalOrigin place the label around its position, and the lines of a multi-line label are aligned towards the side of horizontalOrigin. Labels are not decluttered: overlapping labels are all drawn.

A point is drawn as a circle pixelSize screen pixels across, and a billboard as its image facing the screen. A relative image URI is resolved against the URL given to load({ url }), or against the page for load({ data }). A data URI is used as is.

A scale of 1 draws the image at its own pixel size. pixelOffset, horizontalOrigin and verticalOrigin place the billboard around its position, and rotation turns it about the point its origins put on the position. With sizeInMeters, a pixel of the image is a meter. width and height are not supported: a billboard keeps the aspect of its image. Like labels, points and billboards are not decluttered.

A flood simulation exported as CZML typically has one set of polygons per time step: each packet has an availability, perPositionHeight with the water level as the height of every position, and holes. Some also give an extrudedHeight, and are then filled from it up to the water surface. The plugin shows such a document one time step at a time, switching from one set of polygons to the next when the time it is shown at passes the end of a step. The water surface does not move between two steps.

To play a flood with a water surface that rises continuously, convert the simulation output for @navaramap/three-flood-mesh instead. See Converting Data.

  • Heights are above the ellipsoid. An extrudedHeight, the heights of polyline, label, point and billboard positions, and the heights of the positions of a polygon with perPositionHeight are used as given. A polygon with an extrudedHeight and no perPositionHeight stands on the ellipsoid: the heights of its positions are not used. With perPositionHeight, its bottom lies flat at extrudedHeight above the ellipsoid.
  • Only polylines with clampToGround are draped. They are drawn into the surface tiles, so they need a raster or terrain layer under them, and the heights of their positions are not used. Their width is in texels of the surface tile rather than in screen pixels, so the width of a line on screen changes with the level of the tile it is drawn into. While a document whose draped polylines have a sampled color plays, they are drawn into the tiles again on every frame.
  • Polygons need scene lights. They are shaded by the lights of the scene, so a scene without lights draws them black. Add at least an ambient light.
  • Translucent polygons blend only their nearest surface. When any polygon color of a document has an opacity below 1, the polygon layer is drawn with transparent and depthPrePass, so the faces behind the nearest one do not add to its opacity.
  • Polylines are unlit. They show the CZML color as given, whatever the lighting.
  • Translucent polylines are blended. When any polyline color of a document has an opacity below 1, the polyline layer is drawn with transparent.
  • Translucent points and billboards are blended. Billboards are always drawn with transparent, as their images carry an alpha. When any point color of a document has an opacity below 1, the point layer is drawn with transparent.
  • Labels have an opaque background. The alpha of backgroundColor is not applied.
  • Picking returns the packet id. The properties.id of a picked feature is the id of its packet.