Switch between 2D projections

Hey everyone!

I am looking for a way to switch “on-the-fly” between 2 different 2D projections (GeographicProjection and WebMercatorProjection). The goal is to compare the distortion of overlaying images.
The only way I found in the documentation is to set the 2D map projection in the Viewer options which means that I would have to destroy the old Viewer and create a new one to switch to the other 2D projection.

Is there a way to change the 2D projection directly and ideally with a nice morph animation?

Thanks in advance!
Best Phil

This sounds like a pretty interesting use case! What kind of application are you building?

Does setting that projection option on the viewer show you the difference you’re looking for? I ask because it looks like this affects how geometry and 3D models/3D tiles are rendered, but satellite imagery is controlled by its tiling scheme:


So you can have individual layers of imagery with different projections, which you could use to toggle on/off to show the difference, or alpha-blend between them. Or perhaps do something like a side by side view:


Or a split view to compare:


I think it may not be too hard to morph from one projection to another since Cesium can already do this between the 3D view and the 2D view, but it’s not currently a built-in feature, and would be hard to do from the application level.

Thanks for your reply!

We want to build an application which shows the same imagery in multiple projections (as a Globe, GeographicProjection and WebMercatorProjection). The imagery itself is always in the same projection, we just want to be able to view it differently.
I was hoping that there was a “standard” way of switching between two 2D projections on the fly. I think we’ll check out how it works with creating a new viewer object for that before going deeper into the code.

Thanks again for your answer!