Loading 3DTile from tileset.json string/json/object instead of url

Hello,

I am trying to load a 3dtile from a object instead of a url. The object structure would be the same as the object/json in the tileset.json file but with some changes. For example, I would like to use

cesiumViewer.scene.primitives.add(new Cesium.Cesium3DTileset({
   url: url,
})

but instead of url, I would like to pass in an object. Is this possible?

The reason why I want to do this is because I want to first fetch the tileset.json and then edit out a child in the tileset.json file and then load that newly edited tileset.json file. I am trying to do this but there was no solution in that thread. I know I can edit the tileset.json file before hand but I need to do it on the fly. The tileset contains 1000+ children so I cannot split them and load them separately because that would be very slow.

Hi there,

You can make an object into a data uri:

const uri = `data:text/plain;base64,${btoa(JSON.stringify(tilesetJson))}`;

and then use that when constructing your 3D Tileset:

cesiumViewer.scene.primitives.add(new Cesium.Cesium3DTileset({
   url: uri,
})
1 Like

Thank you!