Difference between viewer.flyTo and camera.flyTo

Hi,

Is there any difference between viewer.flyTo and camera.flyTo? I could see that the camera.position value is different after applying above functions.

Thanks,
Gowtham

camera.flyTo is a lower-level function. It gives you full control of the flight but expects you to have all of the required information up front. For example, you can’t fly to a 3D model, you need to know the location of the 3D model, how you want the final view to be oriented, and the correct distance away from the model so that it is fully in view.

viewer.flyTo is a higher-level function that takes an Entity, EntityCollection, DataSource, or array of Entities, determines what visualization they are using and then attempts to generate a good view to fly to so that the visualization is in view. It actually calls camear.flyTo under the hood. So if you pass viewer.flyTo an array of 2 entities, one with a polygon and another with a 3D model, it determines a view that makes sure they are both in view and then initiates a flight.