Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cesium ion support to the Add Data panel #7193

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Add Cesium ion support to the Add Data panel #7193

wants to merge 28 commits into from

Conversation

kring
Copy link
Member

@kring kring commented Jun 9, 2024

This adds a new "Cesium ion" option to the My Data -> Add web data panel:

image

Clicking the "Connect to Cesium ion" button pops up a separate window to sign in to Cesium ion:
image

Press "Allow", and Terria will query your Cesium ion account for tokens and assets:
image

Choose an appropriate token and then click the + next to a dataset. The dataset is added to the Workbench and the My Data list as usual:
image

Just like in the normal Terria catalog, you can hold down shift or control to keep the panel open so you can quickly add multiple datasets.

The token selection is important because this token is used to access the asset, which means that if you create a Share URL, that token will be embedded in it and available to anyone that has the Share URL. You probably don't want to use a token that has access to all of your assets.

To set this up in your Terria Map, you need to first create an OAuth2 Application on Cesium ion. Here's the one I set up for local testing:

image

You can use this same one for testing on localhost. Open up your TerriaMap config.json and add this to the parameters section:

"cesiumIonOAuth2ApplicationID": 643,

For a TerriaMap not running on localhost, though, you'll need to set up your own. The Redirect URI should be

https://example.com/TerriaMap/build/TerriaJS/cesium-ion-oauth2.html

Replace https://example.com/TerriaMap with the base URL of your TerriaMap, of course. And then put the "ClientID" that Cesium ion provides in the cesiumIonOAuth2ApplicationID property in config.json.

Note that the Cesium ion support will only work on localhost and on https URLs, so it can't work on ci.terria.io because it only supports http. This is because it uses crypto.subtle.

All of the Cesium ion asset types can be imported, including 3D Tiles, glTF, KML, CZML, GeoJSON, Terrain, and Imagery. I had to extend some of these CatalogItem types to support Cesium ion, which I did via a CesiumIonMixin.

There's one quirk with glTF, though. I'm currently importing models to be located at null island, because that's better than the center of the Earth. It should probably integrate with the Model Editor instead, but I didn't explore this.

Sort of fixes #6388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cesium ion as a Catalog Groups
1 participant