Skip to content

GeoJsonPrimitive: Support clamped HeightReference - #13711

Open
donmccurdy wants to merge 3 commits into
DanielZ/feat/vector-3dtiles-polygonfrom
donmccurdy/feat/geojsonprim-heightreference-clamp
Open

GeoJsonPrimitive: Support clamped HeightReference#13711
donmccurdy wants to merge 3 commits into
DanielZ/feat/vector-3dtiles-polygonfrom
donmccurdy/feat/geojsonprim-heightreference-clamp

Conversation

@donmccurdy

@donmccurdy donmccurdy commented Aug 20, 2026

Copy link
Copy Markdown
Member

Description

Allows use of clamped HeightReference options with GeoJsonPrimitive.

Issue number and link

n/a

Testing plan

Screenshot 2026-08-20 at 1 46 39 PM
import * as Cesium from "cesium";

const terrain = Cesium.Terrain.fromWorldTerrain();
const viewer = new Cesium.Viewer("cesiumContainer", {terrain});

window.viewer = viewer;

const prim = new Cesium.GeoJsonPrimitive({
  heightReference: Cesium.HeightReference.CLAMP_TO_TERRAIN,
  scene: viewer.scene,
  geoJson:{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -21.0205342,
              33.4930122
            ],
            [
              -2.452129,
              28.8391351
            ],
            [
              -1.0079093,
              37.5961399
            ],
            [
              -15.872334,
              43.690817
            ],
            [
              -28.0149113,
              41.298494
            ],
            [
              -21.0205342,
              33.4930122
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              5.3598656,
              40.6971887
            ],
            [
              5.3598656,
              40.6971887
            ],
            [
              5.3598656,
              40.6971887
            ],
            [
              5.3598656,
              40.6971887
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              7.0446799311852715,
              38.543931943776784
            ],
            [
              22.660401203559474,
              37.37844114327537
            ],
            [
              19.905181227216417,
              26.68449771610058
            ],
            [
              6.262298933950717,
              27.891271337207428
            ],
            [
              7.0446799311852715,
              38.543931943776784
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            -6.1582405,
            45.4765483
          ],
          [
            3.3412389,
            50.0247762
          ],
          [
            3.4903598,
            43.1650568
          ],
          [
            9.1983068,
            46.6367064
          ],
          [
            10.786459,
            41.6176047
          ],
          [
            23.3025144,
            44.7244527
          ],
          [
            23.0069026,
            40.4267745
          ]
        ]
      }
    }
  ]
}});


viewer.scene.primitives.add(prim);

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

AI acknowledgment

  • I used AI to generate content in this PR
  • If yes, I have reviewed the AI-generated content before submitting

If yes, I used the following Tools(s) and/or Service(s):

If yes, I used the following Model(s):

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for the pull request, @donmccurdy!

✅ We can confirm we have a CLA on file for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant