Cargar nube puntos tileset.json

Good morning: I’m trying to create a cesium that reads point clouds through a tileset.json (I exported this file from my ceisum ion to test with formats that are well structured), but I can’t get the points to be seen or the camera to point to that side const fileInput = document.getElementById(‘fileInput’);

(index.js)

// Initialize the Cesium viewer
const viewer = new Cesium.Viewer("cesiumContainer", {
  terrainProvider: Cesium.createWorldTerrain(),
});

// Handle the loading of the tileset.json file
fileInput.addEventListener("change", async (event) => {
  const file = event.target.files[0];
  if (!file) return;

  try {
    const fileContent = await file.text();
    const tilesetJson = JSON.parse(fileContent);

    // Create a Blob URL to handle the file as a local resource
    const blob = new Blob([JSON.stringify(tilesetJson)], {
      type: "application/json",
    });
    const blobUrl = URL.createObjectURL(blob);

    // Load the tileset in Cesium
    const tileset = new Cesium.Cesium3DTileset({ url: blobUrl });

    // Add the tileset to the scene
    viewer.scene.primitives.add(tileset);

    // Make sure the camera is focused correctly
    tileset.readyPromise
      .then(() => {
        // Check if the boundingSphere is defined and move the camera
        const boundingSphere = tileset.boundingSphere;
        if (boundingSphere) {
          viewer.scene.camera.flyToBoundingSphere(boundingSphere, {
            duration: 2, // Flight duration
          });
        } else {
          console.warn("Could not find boundingSphere in the tileset.");
        }
      })
      .catch((error) => {
        console.error("Error loading tileset:", error);
      });
  } catch (error) {
    console.error("Error reading file:", error);
  }
});

Edited for formatting

As a baseline: When you add

console.log("Now trying to fly to " + boundingSphere); //  THIS LINE

viewer.scene.camera.flyToBoundingSphere(boundingSphere ....

in your code, is this message printed to the console?

(It could be much easier to test this if you could provide a Sandcastle - but right now, it is not clear if something is wrong with the tileset, the file access, or any other aspect of your setup)