cesium 加载kml polygon和mark(贴地形terrain效果)

key code:

var options = {
    camera : viewer.scene.camera,
    canvas : viewer.scene.canvas,
    clampToGround: true //开启贴地
};
viewer.camera.flyHome(0);
        var a = viewer.dataSources.add(Cesium.KmlDataSource.load('../data/kml/test_geojson_test.kml', options));
        a.then( viewer.flyTo(a));
        a.then(function(dataSource) {
            var entities = dataSource.entities.values;
           for (var i = 0; i < entities.length; i++) {
              var entity = entities[i];
         // 设置每个entity的样式    entity.billboard.disableDepthTestDistance
= Number.POSITIVE_INFINITY; //去掉地形遮挡   entity.billboard.color = Cesium.Color.WHITE;   entity.billboard.image = '../data/kml/img.jpg'; } });

 

posted @ 2018-07-30 09:46  seethetruth  阅读(6790)  评论(4编辑  收藏  举报