Cesium知识点:根据经纬度获取高程

// 根据经纬度获取高度
function getHeigthByLonLat(lon = 87.5968, lat = 43.8084){
	var positions = Cesium.Cartographic.fromDegrees(lon,lat);
	var promise = new Cesium.sampleTerrain(viewer.terrainProvider, 13, [positions]);
	promise = Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, positions);
	Cesium.when(new Cesium.sampleTerrain(viewer.terrainProvider, 13, [positions]), function (updatedPositions) {
		console.log("zhang",lon,lat,updatedPositions[0].height);
	});
}

 

你可能感兴趣的:(前端:Cesium)