Screen Coordinates

661 views
Skip to first unread message

Tamy

unread,
May 14, 2013, 11:31:52 AM5/14/13
to cesiu...@googlegroups.com
Hello!

I need to know what is the upper-left and the lower-right coordinates on the map of the screen (or upper-right and lower-left). I want to save the coordinates to view an extend in future.
I know I can save and load camera properties. But I need the longitude/ latitude values.
How can I do that?
Thanks!

Daniel Bagnell

unread,
May 14, 2013, 2:35:53 PM5/14/13
to cesiu...@googlegroups.com
Hi Tamy,

Do you need the extent that is visible from the camera? Do you need it for a specific mode or all three? Calculating the visible extent will be different in all three modes.

Dan

Tamy

unread,
May 15, 2013, 8:20:03 AM5/15/13
to cesiu...@googlegroups.com
Hi Dan,

I need the extent of what I'm seeing at the moment on the screen. I need for 2D and 3D modes.
Thanks!

Tamy

Tamy

unread,
Jun 14, 2013, 11:59:33 AM6/14/13
to cesiu...@googlegroups.com
Hi!

How can I calculate the visible extent from camera in 2D and 3D??

Thanks!

Matthew Amato

unread,
Jun 17, 2013, 10:46:56 AM6/17/13
to cesiu...@googlegroups.com
I don't think it's a simple thing to do, but I think it's a common enough request that we should have support for it out of the box.  I've created Github issue #871 for it.


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tamy

unread,
Jun 19, 2013, 7:36:06 AM6/19/13
to cesiu...@googlegroups.com
I solved my problem:

function getExtentView(){
        var c2 = new Cesium.Cartesian2(0,0);
        var leftTop = scene.getCamera().controller.pickEllipsoid(c2, ellipsoid);
        c2 = new Cesium.Cartesian2(scene.getCanvas().width, scene.getCanvas().height);
        var rightDown = scene.getCamera().controller.pickEllipsoid(c2, ellipsoid);
        if(leftTop != null && rightDown != null){
            leftTop = ellipsoid.cartesianToCartographic(leftTop);
            rightDown = ellipsoid.cartesianToCartographic(rightDown);
            return new Cesium.Extent(leftTop.longitude, rightDown.latitude, rightDown.longitude, leftTop.latitude);
        }else{//The sky is visible in 3D
            return null;
        }
    }

linde...@gmail.com

unread,
Jun 25, 2013, 2:46:56 PM6/25/13
to cesiu...@googlegroups.com
Thanks for posting this Tamy. This was helpful to me as well. I'm sure this is the holy grail, but has anyone come up with a good solution to the "sky is visible" problem?

Thomas Lefort

unread,
Jul 2, 2015, 10:09:21 AM7/2/15
to cesiu...@googlegroups.com, linde...@gmail.com
Just thinking out loud here... Couldn't we set the camera as a sensor (I remember there was some sensor library in the past), calculate the intersection of the sensor with the geoid and get the bounds of that shape? would that work?
Reply all
Reply to author
Forward
0 new messages