Problem integrating dataset with deck gl

Hello,

I’m experimenting with MapBox and Deck.gl Tile3DLayer, I’m trying to load the Cesium OSM Building Asset. I’m using my access token in the configuration of the deck.gl layer.

The first call being made is https://api.cesium.com/v1/assets that return a 404 in my browser’s network console. I can see in this call that my token is sent in the http headers

This is what the deck.gl initializing looks like:

      new Tile3DLayer({
        id: "tile-3d-layer",
        // tileset json file url
        data: "https://assets.ion.cesium.com/asset_depot/96188/OpenStreetMap/2023-01-02/tileset.json",
        loader: CesiumIonLoader,
        // https://cesium.com/docs/rest-api/
        loadOptions: {
          "cesium-ion": {
            accessToken:
              "<my-access-token>"
          }
        },

Am I missing something? I don’t have a paying account yet, I’m just experimenting.

When I load the https://api.cesium.com/v1/assets url in my browser in a separate windows, I can load the configuration without problem, and I see the 5 assets that are part of my account (I mean loading the url that returns a 404 in my browser’s console in another tab, I’m inheriting the api token set in a cookie).

Would it be a CORS problem? I’m running my dev app in localhost on port 8083, in https

I’m sorry for the delayed reply here. deck.gl is not a Cesium project/product, so I’m not very familiar with it, but I do notice there are some issues with how you are using the ion API.

Specifically, you are trying to hard-code an asset URL into your application, which is not how Cesium ion works. You must always request the asset from the REST API endpoint in order to receive a url (which may change over time) and token (which definitely changed over time) to load the layer in your application.

Basically:

  1. Call https://api.cesium.com/v1/assets/{assetId}/endpoint where {assetId} is replaced with the asset, in your example, 96188.

  2. This will return the endpoint information which has several important pieces of data:

{
  "type": "3DTILES",
  "url": "https://assets.cesium.com/96188/tileset.json",
  "accessToken": "...",
  "attributions": [
    {
      "html": "<span><a href=\"https://cesium.com\" target=\"_blank\"><img alt=\"Cesium ion\" src=\"http://assets.cesium.com/ion-credit.png\"></a></span>",
      "collapsible": false
    }
  ]
}
  • type - The type of data, in case you are writing a generic viewer and need to discover it at runtime
  • url - The current url of the asset, this maps to the data property in your example
  • accessToken - A token that gives you temporary direct access to the asset, which should also map directly into your example.
  • attributions an array of HTML attributions that need to be displayed in the application in order to meet licensing requirements for using this dataset. For example, OSM data requires additional attribution on top of the general ion attribution requirement.

I can’t speak to the aspects of deck.gl itself, but I think this will get you most of the way there. Our complete REST API documentation for accessing tiles is available at Ion REST API documentation – Cesium, but also happy to answer additional questions you may have.

Thanks Matt, I completely missed out the REST API part in my setup. It will most probably fix all my problems, thanks!