// 通过经纬度获取高程
function getheightbylonlat(lon,lat){
var terrainProvider = Cesium.createWorldTerrain();
var positions = [
Cesium.Cartographic.fromDegrees(lon,lat)
];
// var promise = new Cesium.sampleTerrain(this.viewer.terrainProvider)
var promise = new Cesium.sampleTerrainMostDetailed(terrainProvider,positions);
Cesium.when(promise,function(updatedPositions){
console.log(positions[0].height);
// console.log("updatedPositions"+updatedPositions);
})
}
// 读取经纬度
this.$http
.get("./public/jwd.json")
.then((response) => {
var data = response.data;
data.forEach(element => {
getheightbylonlat(element.a,element.b);
// console.log(element.a+","+element.b);
});
})