# Polygon in 3d not working

**URL:** <https://community.cesium.com/t/polygon-in-3d-not-working/18924>\
**Category:** CesiumJS\
**Created:** [June 5, 2022, 6:20pm UTC](https://community.cesium.com/t/polygon-in-3d-not-working/18924 "2022-06-05T18:20:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.Lion](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mr.lion/32/6010_2.png) [@Mr.Lion](https://community.cesium.com/u/Mr.Lion)\
**Post date:** [June 5, 2022, 6:20pm UTC](https://community.cesium.com/t/polygon-in-3d-not-working/18924/1 "2022-06-05T18:20:12Z")

</div>

Hi,

I drew a polygon. So far this works fine.  
But if I have also defined a height to display the polygon as 3D, I get the general error.

![image](https://global.discourse-cdn.com/cesium/original/2X/e/e79fa5ee0c25db822f24ffeabd55ac312bfdc408.png)

```auto
viewer.entities.add({
   polygon: {
           hierarchy: new Cesium.PolygonHierarchy(esium.Cartesian3({x,y,z})),
           material: Cesium.Color.BLUE.withAlpha(0.6),
           extrudedHeight: 100,
           height: geoData.altitude! ?? 0,
           heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
        }
});

```

The value for the “hierarchy” is passed by mouse position. So I’ve abbreviated it a bit here.

Can someone tell me what I’m doing wrong here?  
Why can’t I use the height etc. here?  
Please help!

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jacky/32/7686_2.png) [@Jacky](https://community.cesium.com/u/Jacky)\
**Post date:** [June 6, 2022, 10:19am UTC](https://community.cesium.com/t/polygon-in-3d-not-working/18924/2 "2022-06-06T10:19:51Z")

</div>

> [@Mr.Lion](#):
>
> `Cesium.PolygonHierarchy`

PolygonHeirarchy must be an array. And it would be easy for us to understand your issue with the help of a basic sandcastle example.

“height” property will be ignored if you are using heightReference Clamp to ground.  
Check this basic [example](https://sandcastle.cesium.com/#c=lVJPb5swFP8qT5yIlJkwtguj0ToqLYe2qdJulzJVDjyCNWNHtkmbRvnuMxjSJOsOgwN+v3/P2C9FzZqa3FBTEY1mQUUh69umXqK6Ryz88GP0afQlE5nIpdAGNgyfUcEFCHyG1Jl/dpifeXlXp1IYygSqzBvDDpgo5Tf5EkNJuUbYt2kuC4VhhqG2aS6WDEjXcCgILQp/lwmAteTblRQxdBVAxVBRlVfb+Hg7d041G0jfiWHgU6qMXVERkVLJ+gpXClFfKkW3/uOgBfgQhhGZjN+AaHJSWn7yf3x0zofk8zEfnvPRv/2/Rm416hF8MaopsJghW1Umtptpn4Oh6uHwFK6pQcUojw9nI7lU3bG4SfB3QPm6otZJJvbuel8QuMAFlqhQ5HgImJ3iJL2+vLl7epg/fV/Mf9xeWSc09vrr2t4umIpp4HZUwEjQaD8VQsHK3tz22tuOezeA7u0n5VXK+kH6Z3PTCr2xl2iz5Tgdzuorq9dSGWgU9wkJDNZrbn9cB8sm/42G5LozttIkOLYmBdsAKy7emWzIOdXaMmXD+T17xcybJoHV/2XlkhZMrOYbVJxuW1kVTq8dSAhJAlu+7zRS8iVVZ8l/AA).

- Regards
