# Displaying extruded polygons while using GroundPrimitive

**URL:** <https://community.cesium.com/t/displaying-extruded-polygons-while-using-groundprimitive/4130>\
**Category:** CesiumJS\
**Created:** [May 19, 2016, 3:16pm UTC](https://community.cesium.com/t/displaying-extruded-polygons-while-using-groundprimitive/4130 "2016-05-19T15:16:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hballal](https://avatars.discourse-cdn.com/v4/letter/h/439d5e/32.png) [@hballal](https://community.cesium.com/u/hballal)\
**Post date:** [May 19, 2016, 3:16pm UTC](https://community.cesium.com/t/displaying-extruded-polygons-while-using-groundprimitive/4130/1 "2016-05-19T15:16:05Z")

</div>

Hello,  
The goal of my little side project is to show buildings (extruded polygons) draped over a terrain.

I have been able to add a terrain mesh, a geoJSON of the "building footprints" to the map. Screenshot here: [http://imgur.com/TocZDMT](http://imgur.com/TocZDMT)

Now I want to extrude the polyons. following is my code to generate the extrusions

var allGeometryInstances = ;  
// loop over the polygon features  
// create a degreesArray for the polygon feature geojson  
var degreesArray = coordsToDegreesArray(curFeat['geometry']['coordinates'][0])  
var extrudedPolygon = new Cesium.PolygonGeometry({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;polygonHierarchy : new Cesium.PolygonHierarchy(  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cesium.Cartesian3.fromDegreesArray(degreesArray)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extrudedHeight: 40  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var polygonInstance = new Cesium.GeometryInstance({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geometry : extrudedPolygon,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id : randomid(),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attributes:{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});

allGeometryInstances.push(polygonInstance);

and finally:  
&nbsp;&nbsp;&nbsp;&nbsp;scene.primitives.add(new Cesium.GroundPrimitive({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geometryInstances : allGeometryInstances  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}));

When I run this code, the height is not rendered. What am I missing?

Hrishi

---

<div class="post-metadata">

**Author:** ![hballal](https://avatars.discourse-cdn.com/v4/letter/h/439d5e/32.png) [@hballal](https://community.cesium.com/u/hballal)\
**Post date:** [May 19, 2016, 3:23pm UTC](https://community.cesium.com/t/displaying-extruded-polygons-while-using-groundprimitive/4130/2 "2016-05-19T15:23:35Z")

</div>

OK I reveiwed the archive and looks like what I am trying to do is not supported. I am going to try to sample the underlying terrain for polygon heights and draw polygon via that instead of using the groundprimitive.
