tentone / potree-core

Potree point cloud viewer library core components for easier integration in a three.js project.
https://tentone.github.io/potree-core/
Other
171 stars 53 forks source link

Can't load octree from protected storage #26

Closed vadzim-rakevich-softensity closed 1 year ago

vadzim-rakevich-softensity commented 1 year ago

Cannot add sas token when trying to download hierarchy.bin and octree.bin files.

I guess passing 'xhrRequest' param here and replacing 'fetch' with 'xhrRequest' when loading octree and hierarchy would fix the problem.

Another possible solution is to check how the path to octree.bin and hierarchy.bin is formed . Replacing ${this.url}/../octree.bin with ${this.url}.replace('/metadata.json' ,'/octree.bin') would solve the problem in my case.

Thanks.

tentone commented 1 year ago

Hello

For wich version of the lib is this happening?

The current master or the under works 2.0?

Thanks a lot!

vadzim-rakevich-softensity commented 1 year ago

Hi

I am using potree-core 2.0.3. I guess it is current master.

Thanks.

tentone commented 1 year ago

Since you already have a proposel to solve the issue feel free to open a PR to apply the changes suggested.

If you prefer i can do it myself but since you have already have prepared this you can go ahead

Thanks a lot once again!

DJ-caddev commented 1 year ago

Hello,

I have just installed version 2.0.4 of potree-core, including PR #27 .

I think this might have broken compatibility with "old" system, and induces an infinite fetch of the metadata.json file again and again, without having anything loading at all at the end, because octree.bin should have been fetched, normally. In the commit a126e188613fe09a1ad876a2559f8526e2487537 , I noticed that the URL formation had changed ( a '../' has been removed). Is is related? I didn't notice any other change in other commits (mostly doc and examples changes), maybe I missed something else.

In our usage, we fetch distant matadata.json and octree.bin files. The URL looks like https://SERVER_IP/ID/octree.bin The loader is using the URL this way: image

EDIT: fixed with commit df8b42683382c39f364232b839d15f622a61d66e

hamza-iqbal-ad commented 4 weeks ago

Cannot add sas token when trying to download hierarchy.bin and octree.bin files.

I guess passing 'xhrRequest' param here and replacing 'fetch' with 'xhrRequest' when loading octree and hierarchy would fix the problem.

Another possible solution is to check how the path to octree.bin and hierarchy.bin is formed . Replacing ${this.url}/../octree.bin with ${this.url}.replace('/metadata.json' ,'/octree.bin') would solve the problem in my case.

Thanks.

Replacing the filename doesnt work for s3 presigned urls because the url are completely different from each other. I am stuck on this issue, can someone please resolve this blocker?

tentone commented 3 days ago

Hello

We can maybe include a costumizable file retrieve system that can be adapted for you scenario.

But this can also be solved on your side with a intermediary piece of software that converts these.

im-hamza-dev commented 3 days ago

I have resolved the issue for now by overriding my window.fetch function and replacing the octree.bin url with the correct one like this:

` const nativeFetch = window.fetch;

window.fetch = function (...args) {

  if (args[0].toString().includes('hierarchy.bin')) {

    args[0] = urls.hierarchy;

  } else if (args[0].toString().includes('octree.bin')) {

    args[0] = urls.octree;

  } else if (args[0].toString().includes('metadata.json')) {

    args[0] = urls.metadata;

  }

  return nativeFetch.apply(window, args);

};`