Camera Controller - Zooming in at different locations

I have a question about the camera zoom and position controls.

I wish to implement a zooming feature similar to the one google maps has. I want to be able to zoom and focus on a point the user double clicks on. I also want to be able to change locations at the same zoom level and then continue zooming at this new location.

Currently, I am using viewer.scene.getCamera().controller.setPositionCartographic() to change locations. However, each time I call this method, it zooms in TOO closely! Is there a way to just change locations without zooming?

Because it is zooming in so much at each location change, I am having to zoom out each time as well (using viewer.scene.getCamera().controller.zoomOut()).. which isn't practical for my application.

I guess my main question is, how can I change locations of the camera without needing to zoom out each time?

Thanks for all your help!

Hi Lydia,

It zooms to the height of the cartographic passed to setPositionCartographic. You can set the height to the height of the current camera position.


Great, thank you Dan!