Displaying extruded polygons while using GroundPrimitive

218 views
Skip to first unread message

hba...@gmail.com

unread,
May 19, 2016, 11:16:05 AM5/19/16
to cesium-dev
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

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({
polygonHierarchy : new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray(degreesArray)
),
extrudedHeight: 40
});

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

allGeometryInstances.push(polygonInstance);

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


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

Hrishi

hba...@gmail.com

unread,
May 19, 2016, 11:23:35 AM5/19/16
to cesium-dev, hba...@gmail.com
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.

On Thursday, October 15, 2015 at 7:06:39 PM UTC+1, Hannah Pinkos wrote:
> Sorry, but that functionality is not supported at this time.  A ground primitive cannot also have an extruded height.
>
>
> Best,
>
>
> Hannah
>
> On Thursday, October 15, 2015 at 2:03:48 PM UTC-4, supar...@gmail.com wrote:Hi, I am trying to draw an extruded polygon on terrain which is a ground primitive.
> Any help to implement a ground primitive with Polygon Geometry instance along with extruded height for the polygon is appreciated.
Reply all
Reply to author
Forward
0 new messages