使用cesium点击地图获得该位置的经纬度高度
作者:互联网
dbClick(viewer) {
var handler= new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function (event) {
var earthPosition = viewer.camera.pickEllipsoid(event.position,viewer.scene.globe.ellipsoid);
var cartographic = Cesium.Cartographic.fromCartesian(earthPosition, viewer.scene.globe.ellipsoid, new Cesium.Cartographic());
var lat=Cesium.Math.toDegrees(cartographic.latitude);
var lng=Cesium.Math.toDegrees(cartographic.longitude);
var height=cartographic.height;
console.log("[Lng=>"+lng+",Lat=>"+lat+",H=>"+height+"]");
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
},
},
标签:Cesium,经纬度,cartographic,viewer,scene,height,var,点击,cesium 来源: https://www.cnblogs.com/1229834468wty/p/13343345.html