cesium 使用j2000坐标系需要
时间: 2023-08-02 20:06:25 浏览: 73
要在Cesium中使用J2000坐标系,需要在创建场景时将其设置为J2000坐标系。可以使用以下代码将场景设置为J2000坐标系:
```javascript
var viewer = new Cesium.Viewer('cesiumContainer', {
clockViewModel: new Cesium.ClockViewModel(clock),
sceneMode : Cesium.SceneMode.SCENE3D,
shouldAnimate: true,
mapProjection : new Cesium.WebMercatorProjection(),
scene3DOnly : true,
useDefaultRenderLoop : true,
targetFrameRate : 60,
orderIndependentTranslucency : true,
creditContainer : document.createElement('div'),
creditViewport : document.createElement('div'),
contextOptions : {
webgl : {
alpha : true
}
}
});
viewer.scene.globe.ellipsoid = Cesium.Ellipsoid.WGS84;
// Set the scene's central body to use the J2000 reference frame
viewer.scene.centralBody.ellipsoid = Cesium.Ellipsoid.WGS84;
viewer.scene.centralBody.referenceFrame = Cesium.ReferenceFrame.INERTIAL;
```
在这个例子中,我们将场景的中心体设置为使用J2000参考系。我们通过将`viewer.scene.centralBody.referenceFrame`设置为`Cesium.ReferenceFrame.INERTIAL`来实现这一点。此设置将使场景使用J2000坐标系而不是默认的WGS84坐标系。
需要注意的是,Cesium中的某些功能可能需要使用WGS84坐标系,因此在使用场景中的某些功能时可能需要将参考系切换回WGS84坐标系。