handler.setInputAction(function (event) {
//1.椭球面坐标:获取当前点击视线与椭球面相交处的坐标,在加载地形的场景上获取的坐标有误差
//var earthPosition = viewer.camera.pickEllipsoid(event.position,viewer.scene.globe.ellipsoid);
//2.场景坐标:获取场景中任意点击处的对应的世界坐标,需要开启“地形深度检测”(在未开启“地形深度检测”的情况下只能在3DTile上准确获取空间坐标,开启“地形深度检测”后,viewer.scene.pickPosition 也能在非3DTile上准确获取坐标)
viewer.scene.globe.depthTestAgainstTerrain = true;
var earthPosition = viewer.scene.pickPosition(event.position);
//3.地标坐标:获取点击处地球表面的世界坐标,不包括模型、倾斜摄影表面
// var ray = viewer.camera.getPickRay(event.position);
// var earthPosition = viewer.scene.globe.pick(ray, viewer.scene);
if (Cesium.defined(earthPosition)) {
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
原文:https://www.cnblogs.com/pumpkin-123/p/12849548.html