创建建筑白膜:
第一种:加载Geojson建筑物模型数据并渲染
var viewer = new Cesium.Viewer('cesiumContainer'); //添加geojson格式地理数据(由shp格式文件转换得来) Cesium.Math.setRandomNumberSeed(0); var promise =Cesium.GeoJsonDataSource.load('ShangHai3Dtiles.geojson'); promise.then(function (dataSource) { viewer.dataSources.add(dataSource); var entities =dataSource.entities.values; for (var i = 0; i < entities.length;i++) { var entity = entities[i]; var builingHeight = entity.properties.Floor; if(builingHeight>=3&&builingHeight<10){ entity.polygon.material = Cesium.Color.GOLDENROD; }else if(builingHeight>=10&&builingHeight<20){ entity.polygon.material = Cesium.Color.GRAY; }else if(builingHeight>=20&&builingHeight<30){ entity.polygon.material = Cesium.Color.GHOSTWHITE; }else if(builingHeight>=30&&builingHeight<50){ entity.polygon.material = Cesium.Color.CADETBLUE; }else if(builingHeight>=50){ entity.polygon.material = Cesium.Color.GOLD ; }else{ entity.polygon.material = Cesium.Color.FIREBRICK; } entity.polygon.outline = false; entity.polygon.extrudedHeight =(entity.properties.Floor)*10; } }); viewer.flyTo(promise);
第二种:shp转3dtiles格式数据
参考1:https://blog.csdn.net/feixiegis/article/details/98976250
参考2:https://blog.csdn.net/qq_18144905/article/details/81979807
参考3:https://blog.csdn.net/windydreams/article/details/86296766
第三种:使用内置的
https://cesium.com/learn/cesiumjs-learn/cesiumjs-interactive-building/
cesiumlab生成建筑白膜:https://blog.csdn.net/dyxcome/article/details/86532597
let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function (movement) { var pickingEntity = viewer.scene.pick(movement.position); //判断选择是否为Cesium3DTileFeature if (pickingEntity instanceof Cesium.Cesium3DTileFeature) { //赋值特征颜色 pickingEntity.color = new Cesium.Color(1.0,0.0,0.0,1.0); } }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
Cesium对3dtile单个feature进行特效处理:https://blog.csdn.net/weixin_40184249/article/details/107090321