-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raster layer with a remote COG fails to load #4
Comments
Probably because of this call:
where url is likely nullptr.... (when fetch is called on the main thread -> it immediately fails) |
Okay so the issue is that in https://github.com/wonder-sk/wasm-gdal-sandbox I have used emscripten's synchronous fetch API - it worked because in the test repo I used Using Another try was to avoid emscripten's synchronous fetch API, because it can't be used in the main thread. This would be done by using fetch() directly from EM_JS() in the vsicurl code, together with emscripten's asyncify. Unfortunately this is also a dead end for now, because emscripten does not support Asyncify with Another try was to allow loading of GDAL provider in QgsProject in a worker thread, but that code uses QEventLoop in the main thread, which causes endless "QEventLoop:WaitForMoreEvents is not supported on the main thread without asyncify" logs in browser. I think the proper solution would be that QgsProject is refactored to enable loading of QGIS projects in worker thread(s), with the main thread free to process events while loading. This would make things better also in desktop QGIS where the freeze during project load can be annoying. The refactoring may involve a substantial amount of work though... |
I think We might be able to do that, if we span a main worker thread to load and interact with the QGIS project, and trampoline all API calls to that thread from the browsers main thread. (see https://emscripten.org/docs/api_reference/proxying.h.html) The GDAL patch can then just fetch synchronously and we don't have to change anything in QGIS. This was working with the "osgearthwasm" prototype. But with the cost of breaking most of the stuff from the Qt WebAssembly platform plugin (which we are not relaying on at the moment). |
Indeed!
My worry with that kind of approach is that it would add yet more complexity to the code, and it will be harder to understand all the juggling between the threads. My preference would be to fix the QGIS code, so that stuff that should be run in a worker thread also runs in desktop QGIS in a worker thread - maybe involving more work, but also more future-proof, keeping qgis-js wrapper smaller and improving UX for desktop QGIS... |
When using a QGIS project that contains a cloud-optimized GeoTIFF (COG) on a remote server, it fails with a runtime error:
We are using our custom implementation of
/vsicurl
that uses emscripten's fetch API to do the requests.It is strange that it crashes on some string construction. In the gdal sandbox this works fine (https://github.com/wonder-sk/wasm-gdal-sandbox), but the whole test case there runs in a worker thread because of the blocking networking calls.
The text was updated successfully, but these errors were encountered: