new Cesium.Cartesian2(x, y)
new Cesium.Cartesian3(x, y, z)
注:默认弧度
new Cesium.Cartographic(longitude, latitude, height)
这里是根据自己在项目中获取坐标的顺序来展示基本的坐标转换
// 获取画布
var canvas = viewer.scene.canvas;
var mouseHander = new Cesium.ScreenSpaceEventHandler(canvas);
// 绑定鼠标左点击事件
mouseHander.setInputAction(function (event){
// 获取鼠标点的windowPosition
var windowPosition = event.position;
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);)
var ray = viewer.camera.getPickRay(windowPosition);
var cartesian = viewer.scene.globe.pick(ray, viewer.scene);
var ellipsoid=viewer.scene.globe.ellipsoid;
var cartographic=ellipsoid.cartesianToCartographic(cartesian);
var ellipsoid=viewer.scene.globe.ellipsoid;
var cartographic=ellipsoid.cartesianToCartographic(cartesian);
var lat=Cesium.Math.toDegrees(cartographic.latitude);
var lng=Cesium.Math.toDegrees(cartographic.longitude);
var alt=cartographic.height;
# Cesium.Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid, result)
var position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);
var ellipsoid=viewer.scene.globe.ellipsoid;
var cartographic=Cesium.Cartographic.fromDegrees(lng, lat, alt);
var cartesian = ellipsoid.cartographicToCartesian(cartographic);
var pick = Cesium.SceneTransforms.wgs84ToWindowCoordinates(viewer.scene, cartesian);
此处仅举几个例子,详细内容大家可以参照各个坐标系统的API
Cesium.Cartesian2.fromCartesian3(cartesian, result)
Cesium.CesiumMath.toRadians(degrees)
Cesium.CesiumMath.toDegrees(radians)