我有一份geojson数据:
const smc={"type":"FeatureCollection", "features": [
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[119.66253898412081,30.368448359079963],[119.66243188888996,30.368413407509607],[119.66239524553978,30.368497829777414],[119.662502340849,30.36853278137794],[119.66253898412081,30.368448359079963]]]},"properties":{"OBJECTID":1,"Shape_Leng":42.0000000005,"Shape_Area":110.000000003,"FWMC":"混","FWCS":"3","YSDM":"141161","X":119.662467115,"Y":30.3684730944}}
]}
使用Cesium.GeoJsonDataSource加载并且想使数据在地形之上,但是我加载之后数据在地形影像下面,按照官网设置了clampToGround为true也没生效,请问有遇到过这个问题吗?要怎么解决呢?
我的代码如下:
const smcPromise = Cesium.GeoJsonDataSource.load(smc,
{
clampToGround: true
}
);
smcPromise.then(dataSource => {
viewer.dataSources.add(dataSource);
const entities = dataSource.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.$name = "smc";
var color = (color = Cesium.Color.fromRandom({
alpha: 1.0
}));
entity.polygon.material = color;
entity.polygon.outline = false;
entity.polygon.extrudedHeight = 10.0;
}
viewer.flyTo(smcPromise);
});