Cesium技术栈

1、屏幕坐标转经纬度

viewer.screenSpaceEventHandler.setInputAction(function onMouseClick(movement) {

// ---------1、movement.position屏幕坐标
var pickedObject = viewer.scene.pick(movement.position);
let pickName = pickedObject.node.name;// 获取点击子模型名称


// ---------2、pickedLocation笛卡尔坐标
var pickedLocation = viewer.scene.pickPosition(movement.position);
var pickedLocationCartographic = Cesium.Cartographic.fromCartesian(pickedLocation); // Convert to cartographic coordinates

// ---------3、经纬度坐标
axisLon = Cesium.Math.toDegrees(pickedLocationCartographic.longitude).toFixed(7); // Get longitude in degrees
axisLat = Cesium.Math.toDegrees(pickedLocationCartographic.latitude).toFixed(7); // Get latitude in degrees
axishei = Cesium.Math.toDegrees(pickedLocationCartographic.height).toFixed(7); // Get latitude in degrees

})


你可能感兴趣的:(javascript,前端,开发语言)