I have these methods on a class. The problem is that getCamera is returning very low values for the lat/lon.
I’ve also tried using Cesium.Ellipsoid.WGS84 as the Ellipsoid.
setCameraPosition(position: CameraPosition): void {
this.viewer.camera.setView({
position: Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, position.range),
heading: 0.0,
pitch: -Cesium.Math.PI_OVER_TWO,
roll: 0.0
});
}
getCameraPosition(): CameraPosition {
var camera = this.viewer.camera;
var ellipsoid = this.viewer.scene.globe.ellipsoid;
var coordinate = ellipsoid.cartesianToCartographic(camera.position);
return {
latitude: coordinate.latitude,
longitude: coordinate.longitude,
range: coordinate.height
};
}