版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
/** * 笛卡尔坐标转WGS84 * @param Cartesian3 单个点或点数组 */ Cartesian3ToWGS84: (Cartesian3) => { if (!Cartesian3 || !Cartesian3.x) { throw "Error in parameters"; } let _cartesian3 = new Cesium.Cartesian3(Cartesian3.x, Cartesian3.y, Cartesian3.z); let _cartographic = Cesium.Cartographic.fromCartesian(_cartesian3); let _lat = Cesium.Math.toDegrees(_cartographic.latitude); let _lng = Cesium.Math.toDegrees(_cartographic.longitude); let _alt = _cartographic.height; return {lng: _lng, lat: _lat, alt: _alt}; },
拾取笛卡尔坐标及应用
var cartesian = viewer.scene.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid); var p = SXYReviewTool.Cartesian3ToWGS84(cartesian);wgsToCartesian:function(point) { var car33 = Cesium.Cartesian3.fromDegrees(point.lng, point.lat, point.alt); var x = car33.x; var y = car33.y; var z = car33.z; return {x: x, y: y, z: z}; },
菜鸟努力中......