Access corner positions of Extruded Polygon

Hi everyone!

Awesome stuff in the b19 release!

Quick question, is there any way to access the positions that where used to create a primitive? More precisely a GeometryInstance whose geometry is a PolygonGeometry.

I understand that storing the creational points of the polygon its pretty expensive memory wise, and it’s usually all about saving memory! But maybe there’s an option like releaseGeometryInstances but for PolygonGeometry positions.

Heres what I’ve got (and is not working for me):

// init stuff

var widget = new Cesium.CesiumWidget(‘cesiumContainer’);

var scene = widget.scene;

var primitives = scene.getPrimitives();

var ellipsoid = widget.centralBody.getEllipsoid();

var handler = new Cesium.ScreenSpaceEventHandler(scene.getCanvas());

// create extruded polygon

var extrudedPolygon = new Cesium.GeometryInstance({

geometry : new Cesium.PolygonGeometry({

     polygonHierarchy : {

         positions : ellipsoid.cartographicArrayToCartesianArray([

                Cesium.Cartographic.fromDegrees(-113.0, 30.0),

                Cesium.Cartographic.fromDegrees(-110.0, 30.0),

                Cesium.Cartographic.fromDegrees(-110.0, 33.0),

                Cesium.Cartographic.fromDegrees(-111.5, 31.0),

                Cesium.Cartographic.fromDegrees(-113.0, 33.0)



        vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,

        extrudedHeight: 300000


attributes: {

    color : new Cesium.ColorGeometryInstanceAttribute(Math.random(), Math.random(), Math.random(), 1.0)



// create primitive

var primitive = new Cesium.Primitive({

geometryInstances: extrudedPolygon,

appearance: new Cesium.PerInstanceColorAppearance({

    translucent: false,

    closed: true


releaseGeometryInstances: false



// handle click

handler.setInputAction(function (pick) {

var pickedObject = scene.pick(pick.position);

if (pickedObject === primitive) {



}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

// see what’s inside

function spyInside(primitive) {

console.log(primitive.geometryInstances.geometry);                            ***//some geometry, works up to here***

console.log(primitive.geometryInstances.geometry.polygonHierarchy);           ***//undefined***

console.log(primitive.geometryInstances.geometry.polygonHierarchy.positions); ***//not a chance***




function spyInside(primitive) {



This function will print the array of positions used to create the polygon to the console. Every three positions in the array represents one Cartesian3 position. (ie. values[0] contains x, values[1] contains y, values[2] contains z, etc)

This array contains all of the positions needed to draw the polygon, which is usually greater than the number of positions given when you defined the polygon hierarchy. The initial set of positions is not currently stored.

Hope this helps!


I was looking for the initial set of positions. But thank you Hannah for the clarification that they are not stored.

Guess I will have to make some kind of structure to hold them and associate each primitive.


If anyone else ever needs this.

The “id” property of GeometryInstance returns as object when the primitive is picked. So you can store pretty much anything inside. According to the reference documentation:

A user-defined object to return when the instance is picked with Context#pick or get/set per-instance attributes with Primitive#getGeometryInstanceAttributes.

My workaround solution was to store the initial set of positions inside the id so it can be accessed later on.