Czml Distance Scaling

CZML distance-based scaling and visibility for billboards, points, labels, or models that should shrink/grow or show/hide based on camera distance. Use when the intent describes scaling by distance, near/far scale, or only showing an entity within a certain camera distance.

CesiumGS Updated

File contents

CZML Distance-Based Scaling & Visibility

  • "scaleByDistance": { "nearFarScalar": [nearDistance, nearScale, farDistance, farScale] } — on "billboard", "point", "label", or "model", linearly interpolates a scale multiplier between nearScale (at nearDistance meters from the camera) and farScale (at farDistance meters), clamped outside that range. It multiplies the graphic's own size (e.g. "pixelSize"/"scale").
  • "distanceDisplayCondition": { "distanceDisplayCondition": [nearDistance, farDistance] } — on the same graphics properties (or the shape itself), only renders the entity while the camera is between nearDistance and farDistance meters away.

Example: a billboard that scales down and disappears with distance

[
  { "id": "document", "name": "Distance scaling", "version": "1.0" },
  {
    "id": "marker-1",
    "position": { "cartographicDegrees": [-75, 40, 0] },
    "billboard": {
      "image": "data:image/svg+xml;base64,PHN2Zy8+",
      "scaleByDistance": { "nearFarScalar": [150, 2.0, 15000000, 0.5] },
      "distanceDisplayCondition": { "distanceDisplayCondition": [0, 15000000] }
    }
  }
]

cesiumgs/cesiumjs-ai-starter-app/tree/main/packages/codegen-czml/skills/czml-distance-scaling commit dda215025a

Frequently asked questions

npx skillmds@latest add cesiumgs/czml-distance-scaling