get world coordinates from camera settings

Hi,

I’m storing the camera settings in variable as follow:

    var camera = $scope.viewer.scene.camera;
    var store = {
      position: camera.position.clone(),
      direction: camera.direction.clone(),
      up: camera.up.clone(),
      right: camera.right.clone(),
      transform: camera.transform.clone(),
      frustum: camera.frustum.clone()
    };

source: [1]

I was wondering how to get the “look-at” position of the camera (the longitude and latitude values of the point observed in the center of the camera view)

I was trying with:

Cesium.Cartographic.fromCartesian(viewer.camera.pickEllipsoi‌​d(camera.position.clo‌​ne().x, camera.position.clone().y))

but that doesn’t work of course … the position of the camera is not where I’m looking at …

Have you any clue on how to accomplish that?

Thanks!

Massimo

[1] https://stackoverflow.com/questions/22268182/cesium-js-save-camera-position/23550082#23550082

Hello Massimo,

If you save the values you’ve listed above, you should get the same camera view if you set those values later on. Why do you need the look at position?

-Hannah

Hi hammah, I need the coordinates so that I can use them in a query to a post gis database

Ah okay. The best way I can think to do this would be to pick the center of the screen by doing something like this:

Cesium.Cartographic.fromCartesian(viewer.camera.pickEllipsoi‌​d(scene.canvas.clientWidth/2, scene.canvas.clientHeight/2));

-Hannah