Help flying to a Rectangle using sceneMode: Cesium.SceneMode.SCENE2D

31 views
Skip to first unread message

sos...@skycatch.com

unread,
Mar 19, 2020, 10:35:33 PM3/19/20
to cesium-dev
1. A concise explanation of the problem you're experiencing.

Flying to a destination from a Rectangle when the view sceneMode: Cesium.SceneMode.SCENE2D is not working as expected. 


```
    const rectangle = Cesium.Rectangle.fromDegrees(left, bottom, right, top)
    const destination = viewer.camera.getRectangleCameraCoordinates(rectangle)

    viewer.camera.flyTo({
      destination
    })
```

When I use a SCENE3D the flyTo works correctly, but using SCENE2D it goes to unexpected places. 


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

It's reproducible on sandcastle: 



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I store a rectangle so when I pick a location I can zoom into the rectangle location with this snippet; 

Omar Shehata

unread,
Mar 20, 2020, 5:34:20 AM3/20/20
to cesium-dev
This looks like a bug to me. I opened an issue here: https://github.com/CesiumGS/cesium/issues/8697

You can pass a rectangle to the destination when doing viewer.camera.flyTo, that seems to work correctly in 3D and 2D. Does that work for you?

sos...@skycatch.com

unread,
Mar 20, 2020, 11:41:29 AM3/20/20
to cesium-dev
Yes, it's working using the rectangle. Thank you so much! 

sos...@skycatch.com

unread,
Mar 20, 2020, 3:37:35 PM3/20/20
to cesium-dev
Following up on this, seems like after flying to the rectangle the method `camera.computeViewRectangle()` is returning undefined. 

Do you have a change to give it a check? I modified your sandcastle a little bit here



On Friday, March 20, 2020 at 3:34:20 AM UTC-6, Omar Shehata wrote:

sos...@skycatch.com

unread,
Mar 20, 2020, 3:46:34 PM3/20/20
to cesium-dev
Well seems more like the rectangle is not available in America 

Reply all
Reply to author
Forward
0 new messages