[GIS] Remove point cloud from Potree/Threejs-scene

javascriptpotreethree-js

I'm updating the cloud.js document while Potree is running on the client. When finished updating, I'd like to update the point cloud for the client. I tried to really update the client to re-read the cloud.js document, but cannot get it to work.

Now, as a workaround I'd like to remove the old pointcloud and add a new one using Potree.addPointcloud(). The second part works, but I want to delete the prevous version of the pointcloud. Is there anyone who can point me in the right direction.

I found something with the remove() method like scene.remove(pointcloud), but it's not recognized as a command.

Best Answer

The point cloud data added into PotreeViewer can be accessed by using viewer.scene.pointclouds array. From this array, you can remove the previously added point cloud data. And If you want to show or hide the pointcloud then you can use the visible property of pointcloud object form viewer.scene.pointclouds array. E.g viewer.scene.pointclouds[0].visible = true; or viewer.scene.pointclouds[0].visible = false;.