Reputation: 97
How can I create a MultiPolygon in Cesium? Not a polygon with a hole, but 2 or more polygons as 1 object. Now I use:
var object = map.entities.add({
polygon : {hierarchy : Cesium.Cartesian3.fromDegreesArray(pathArray),
etc..
For a single Polygon the pathArray is like [x1,y1,x2,x2,x3,y3,x4,y4,...]
For MultiPolygon I expected a nested array like [[path1],[path2],[path3]] but this does not work.
Upvotes: 2
Views: 1749
Reputation: 86
Cesium does not currently have support for a multipolygon. You need to add a new entity for each. You can use a parent entity if you wanted to change things like the 'show' property of a group of entities. You can see an example of how to do this here: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Show%20or%20Hide%20Entities.html&label=Beginner
Upvotes: 3