- When the scene contains copc and is exported to json5, the url is not written into the potree.json5.
to fix this please add geometry.url = url; in potree.js within function CopcLoader as showed below
class CopcLoader {
static async load(file, callback) {
const { Copc, Getter } = window.Copc;
const url = file;
const getter = Getter.http(url);
const copc = await Copc.create(getter);
let geometry = new Potree.PointCloudCopcGeometry(getter, copc);
geometry.url = url;
let root = new Potree.PointCloudCopcGeometryNode(geometry);
- when importing copc - drag and drop, for filename of the copc to be written in the scene objects list, replace this function export in desktop.js
export function loadDroppedPointcloud(cloudjsPath){
const normalized = cloudjsPath.replace(/\\/g, "/");
const segments = normalized.split("/");
// COPC is a single file (e.g. "myfile.copc.laz"), so the name comes from the
// file itself. Folder-based formats (cloud.js / metadata.json) are named after
// their containing folder.
let name;
if(normalized.toLowerCase().endsWith(".copc.laz")){
name = segments.reverse()[0].replace(/\.copc\.laz$/i, "");
}else{
name = segments.reverse()[1];
}
Potree.loadPointCloud(cloudjsPath).then(e => {
let pointcloud = e.pointcloud;
let material = pointcloud.material;
pointcloud.name = name;
viewer.scene.addPointCloud(pointcloud);
let hasRGBA = pointcloud.getAttributes().attributes.find(a => a.name === "rgba") !== undefined
if(hasRGBA){
pointcloud.material.activeAttributeName = "rgba";
}else{
pointcloud.material.activeAttributeName = "color";
}
material.size = 1;
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
viewer.zoomTo(e.pointcloud);
});
};
Thank you
to fix this please add geometry.url = url; in potree.js within function CopcLoader as showed below
Thank you