visgl / loaders.gl

Loaders for big data visualization. Website:
https://loaders.gl
Other
704 stars 193 forks source link

[Bug] Cesium Ion metadata url changed to options.url #3127

Closed techtruth closed 46 minutes ago

techtruth commented 1 day ago

Loader

CesiumIonLoader (preload) then Tiles3DLoader

Description

It appears the metadata structure returned from CesiumIon has changed... When calling CesiumIonLoader.preload, it seems that the ionAssetMetadata object now has its 'url' value under 'options' such that 'options.url' is the intended value...

I am unsure when this changed, but I believe this is a change from the cesium api.

The code below is in loaders.gl and in this case url is always undefined.


    const ionAssetMetadata = await getIonAssetMetadata(accessToken, assetId);
    const { type, url } = ionAssetMetadata; ```

### Expected Behavior

       const metadata = await CesiumIonLoader.preload(
         "https://assets.ion.cesium.com/2275207/tileset.json",
         {                            
           "cesium-ion": {            
             accessToken:             
               "eyJhbG...Xyjt"
             assetId: "2275207",      
           },                         
         },                           
       ); 

I would expect this call to work, and not fail the loader assertion.

### Steps to Reproduce

       const metadata = await CesiumIonLoader.preload(
         "https://assets.ion.cesium.com/2275207/tileset.json",
         {                            
           "cesium-ion": {            
             accessToken:             
               "eyJhbG..YOUR_ACCESS_TOKEN....Xyjt"
             assetId: "2275207",      
           },                         
         },                           
       ); 

### Environment

- Framework version: 4.2.5
- Browser: Chromium 126.0.6478.182
- Node: 20.17.0
- OS: Debian

### Logs

arssert.js:11 Uncaught (in promise) Error: loader assertion failed.
    at assert (assert.js:11:15)
    at getIonTilesetMetadata (ion.js:30:69)
    at async SurfaceScreen.loadTiles (surface.ts:131:24)
ibgreen commented 1 day ago

@techtruth Thanks for reporting. Seems like an small fix. Do need to keep the old way of getting url working as well?

Not sure if we have any maintainer who is working on 3D Tiles right now and is ready to jump on this, so... would you be interested in making a PR?

@dsavinov-actionengine @belom88

ibgreen commented 1 day ago

You can probably try to just modify the CesiumIONLoader object in your own app, or copy it and create your own CesiumIONLoader and verify that the fix works before making a PR.

techtruth commented 46 minutes ago

https://github.com/visgl/loaders.gl/pull/3128 << Created this PR, let me know if you find it helpful. :)