Cesium将笛卡尔坐标转经纬度坐标

鼠标左键事件:

handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function (event) {
      let pick =viewer.camera.pickEllipsoid(event.position);
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);//添加一个鼠标左键操作
let pick =viewer.camera.pickEllipsoid(event.position);

这个时候需要将Cesium笛卡尔坐标转为经纬度坐标,参考如下函数:(coor就是上面的pick)

 GetWGS84FromDKR(coor)
  {
    let cartographic = Cesium.Cartographic.fromCartesian(coor);
    let x=Cesium.Math.toDegrees(cartographic.longitude);
    let y=Cesium.Math.toDegrees(cartographic.latitude);
    let wgs84={
      x:x,
      y:y,
    };
    return wgs84;
  }
QQ群(GIS开发交流、数据共享、软件使用):993836992

你可能感兴趣的:(Cesium,html5,javascript)