How create GroundPrimitive with polyline

Hi,

I want to drape the terrain of KML.

Polygon With the GroundPrimitive was okay.

But polyline does not seem to work.

Any idea Drape on the terrain a polyline?

sample code:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

infoBox : false,

selectionIndicator : false

});

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({

url : ‘//assets.agi.com/stk-terrain/world’,

requestWaterMask : false

});

var scene = viewer.scene;

var url = ‘./data/test.kml’;

var ds = new Cesium.KmlDataSource();

ds.load(url).then(function (dataSource) {

for (var i=0;i<dataSource.entities.values.length;i++){

var _entity = dataSource.entities.values[i];

var _geometry;

if(_entity.polygon!==undefined){

_geometry = new Cesium.PolygonGeometry({

polygonHierarchy : _entity.polygon.hierarchy._value

});

}

if(_entity.polyline!==undefined){

_geometry = new Cesium.PolygonGeometry({

polygonHierarchy : {

positions : _entity.polyline.positions._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;

}

var date = new Date();

viewer.camera.flyTo({

destination: dataSource.entities.entities[1].position.getValue(Cesium.JulianDate.fromDate(date)),

duration:0,

});

});

``

Hi,

Polyline on terrain is still a work in progress.

Have you tried with a corridor geometry?

Guillaume

Hi Guillaume,

Thank you so much!!!

The method is ran as intended.

Thanks,

Ryousuke

2015年9月10日木曜日 16時47分39秒 UTC+9 Guillaume Beraudo:

Hi Ryousuke,

Could you tell me how could you handle the width of corridor when camera is zoomed?
Thank you so much if you can guide me road!

Thanks,
Nill,Yan

在 2015年9月10日星期四 UTC+8下午4:11:37,Ryousuke Wayama写道:

Hi Nill Yan,

What’s the desired behavior with the corridor width?

Best,

  • Rachel