How to drape a geojson file using cesium

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);
                   }

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.

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);
                   }

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

Hi Ben,

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

Eric