Need Example Code for Loading Tileset

I’ve been trying to load my tileset using

try {
    const tileset = await Cesium3DTileset.fromUrl(
        “/url/Path/To/tileset.json”
    )

    tileset.readyPromise.then(() => {
        console.log("tileset loaded")
    })
} catch (error) {
    console.error(error)
}

in my Nuxtjs + Threejs file but I keep getting rangeError: Invalid array length. I’m not even trying to get it to appear in the scene yet, I just want it to load into the tileset variable and I can probably figure out the rest later. I have made sure that the file path is correct, and I’m using the latest version of CesiumJs. The tileset follows the cesium 1.0 version.

I’m pretty sure that there’s nothing wrong with the tileset files because I got it to load successfully on the Cesium Ion web app.

So, can someone please just give me a working example code along with an example cesium tileset that shows me exactly how to get the tileset to load into the app? Something like a GitHub repo that I can just clone into my pc and see the results for myself? I’ve been looking for this for days

const viewer = new Cesium.Viewer(‘cesiumContainer’)

const tileset = await Cesium.Cesium3DTileset.fromUrl(“/url/Path/To/tileset.json”)

viewer.scene.primitives.add(tileset)

@RizalSuhaimi If you are attempting to load a file off disk, you’ll need to make sure it is being served locally. The Offline Guide may have some clues to help.

I’m not sure about your Nuxtjs setup, but that may be coming into play and complicating matters.

Also if you are using ThreeJS for rendering, you likely don’t need to use CesiumJS to load tilesets at all. See this post for some additional context.

1 Like

Hi @Gabby_Getz . Thank you so much for your suggestions. Using TilesRenderer from NASA’s “3d-tiles-renderer” gave me a step in the right direction at least. I think it’s a matter of tweaking the configurations and reading the docs now

1 Like