How to drape a geojson file using cesium

460 views
Skip to first unread message

vhiguit...@gmail.com

unread,
Jun 29, 2016, 5:17:03 PM6/29/16
to cesium-dev
Hi I want to drape the terrain of geojson file, including lines and polygons, as this link. (https://twitter.com/CesiumJS/status/638821250140254208/photo/1), but it looks that the layer is above the map. Any ideas?. Thanks.

This is my code:

var promise= Cesium.GeoJsonDataSource.load('area.geojson');//Load geojson in the world map
var scene = viewer.scene;

promise.then(function(dataSource) {
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);

//Get the array of entities
var entities = dataSource.entities.values;

for (var i = 0; i < entities.length; i++) {
var entity = entities[i];

var _geometry;
if(entity.polygon!==undefined){
_geometry = new Cesium.PolygonGeometry({
polygonHierarchy : entity.polygon.hierarchy._value
});
}
if(!_geometry)continue;
var _geometryInstance = new Cesium.GeometryInstance({
geometry : _geometry,
id : "work_"+i,
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)
}
});
scene.primitives.add(new Cesium.GroundPrimitive({
geometryInstance : _geometryInstance
}));
_geometry=null;
//viewer.flyTo(entity);
}

vhiguit...@gmail.com

unread,
Jun 29, 2016, 5:38:06 PM6/29/16
to cesium-dev, vhiguit...@gmail.com
On Wednesday, June 29, 2016 at 4:17:03 PM UTC-5, vhiguit...@gmail.com wrote:
> Hi I want to drape the terrain of geojson file, including lines and polygons, as this link. (https://twitter.com/CesiumJS/status/638821250140254208/photo/1), but it looks that the layer is above the map (https://drive.google.com/open?id=0B-it1CkHLwEndTZVYVVqd1Z1RTQ). Any ideas?. Thanks.

Hannah Pinkos

unread,
Jun 30, 2016, 10:15:45 AM6/30/16
to cesium-dev, vhiguit...@gmail.com
Hello,

We just added support for entities on terrain and it will be available in the 1.23 release that comes out tomorrow.  See the release blog post for details.

Best,

Hannah
Message has been deleted

Eric Peters

unread,
Jul 5, 2016, 5:50:16 PM7/5/16
to cesiu...@googlegroups.com

Hi Ben,

There is an example in the sandcastle under Gallery->Tutorial s->Ground Clamping.

Eric


On Tue, Jul 5, 2016, 4:32 PM Ben Falchuk <ben.f...@gmail.com> wrote:
.. Hannah - i see that the draping geojson feature is mentioned but i'm struggling to find examples, api or other mentions of it on the sandcastle demos and so on..
--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages