cesium-geojson和kml
作者:
姜治宇 | 来源:发表于
2022-01-21 09:44 被阅读0次 let viewer = new Cesium.Viewer('cesiumContainer');
//geojson
let geoProm = Cesium.GeoJsonDataSource.load('吉林省.geojson', {
stroke: Cesium.Color.YELLOW,
fill: Cesium.Color.RED,
strokeWidth: 3,
});
geoProm.then(dataSource=>{
viewer.dataSources.add(dataSource);
let entities = dataSource.entities.values;
console.log(entities);
for (let i = 0; i < entities.length; i++) {
let entity = entities[i];
let color = Cesium.Color.fromRandom({
alpha: 1.0
});
entity.polygon.material = color;//随机颜色
entity.polygon.outline = false; //去掉边框
entity.polygon.extrudedHeight =5000.0;//带高度
}
});
//kml
let kmlProm = Cesium.KmlDataSource.load('demo.kml');
kmlProm.then(dataSource=>{
viewer.dataSources.add(dataSource);
});

img.gif
本文标题:cesium-geojson和kml
本文链接:https://www.haomeiwen.com/subject/vmijhrtx.html
网友评论