Cesium加载.shp三维城市建筑模型,并根据3DTiles建筑物高度修改颜色

1、Cesium官网例子(纽约)

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=3D%20Tiles%20Feature%20Styling.html

2、加载.shp格式建筑模型

首先将.shp文件转换成Cesium可以加载的文件格式

方法1:参考我的博客转换为3dtiles         推荐一款专为Cesium开源数字地球平台打造的免费数据处理工具集

方法2:转换为Json https://blog.csdn.net/baidu_34304646/article/details/78076900

cesium中加载3dtiles方式如下:

var tj =viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
		name: "qxmodel",
		url: '../../data/tj/tileset.json',
	
		maximumScreenSpaceError: isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
		maximumNumberOfLoadedTiles: isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
	}));

tj.style = new Cesium.Cesium3DTileStyle({
			color: {
				conditions: [
					['${floor} >= 300', 'rgba(45, 0, 75, 0.5)'],
					['${floor} >= 200', 'rgb(102, 71, 151)'],
					['${floor} >= 100', 'rgb(170, 162, 204)'],
					['${floor} >= 50', 'rgb(224, 226, 238)'],
					['${floor} >= 25', 'rgb(252, 230, 200)'],
					['${floor} >= 10', 'rgb(248, 176, 87)'],
					['${floor} >= 5', 'rgb(198, 106, 11)'],
					['true', 'rgb(127, 59, 8)']
				]
			}
		});

猜你喜欢

转载自blog.csdn.net/qq_18144905/article/details/81979807