Open vsharma-next opened 5 months ago
Hi @vsharma-next,
I am glad you love this work, thank you.
/vsicurl/
is not currently supported. I compiled Gdal with Curl to support it but couldn't get it to work. The issue is that Curl is not fully compatible with emscripten. I'll try again when I have more time.
Alternatively, I can release a new version by making the Emscripten Filesystem API public so you can use the following code:
const data = await fetch('http://127.0.0.1:8080/data/simple-polygon-line-point.tif').then(response => response.arrayBuffer());
Gdal.FS.writeFile('/input/simple-polygon-line-point.tif', new Int8Array(data));
const result = await Gdal.open('/input/simple-polygon-line-point.tif');
Would that work for you?
This is a great idea. I think given that OPFS will become more and more prevalent, this API will come in handy. I googled a bit and it seems that Emscripten Filesystem API will be overhauld by WasmFS API which will most likely include support for OPFS (https://github.com/emscripten-core/emscripten/blob/main/test/wasmfs/wasmfs_opfs.c).
@vsharma-next, I exported the Module from Emscripten to version 2.8.0. Can you try the code below with this version?
const Gdal = await initGdalJs();
const data = await fetch('https://gdal3.js.org/test/data/simple-polygon-line-point.tif').then(response => response.arrayBuffer());
Gdal.Module.FS.writeFile('/input/simple-polygon-line-point.tif', new Int8Array(data));
const result = await Gdal.open('/input/simple-polygon-line-point.tif');
console.log(result);
Hello. Love this work. I think this might be one of those watershed experiments that will have a big impact.
Q: Is vsicurl supported ? I would love to replace geotiff.js dependency and just use gdal's vsicurl. This is what I have tried.
code :
result:
Since @rouault seems to also be following this effort, perhaps he can comment as well ?
I have tried it in the browser and it does not work there either - perhaps not too much of a surprise will all the sandbox/security stuff.
Any suggestions ?
Thanks !