Skip to content

Try running gdal in a web worker #560

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"scripts": {
"build": "tsc -b && jlpm run cp:gdal",
"build:gallery": "python rasterlayer_gallery_generator.py",
"cp:gdal": "cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.data lib && cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.wasm lib",
"cp:gdal": "cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.data lib && cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.wasm lib && cp ../../node_modules/gdal3.js/dist/package/gdal3.js lib",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Can we use brace expansion to shorten?

Suggested change
"cp:gdal": "cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.data lib && cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.wasm lib && cp ../../node_modules/gdal3.js/dist/package/gdal3.js lib",
"cp:gdal": "cp ../../node_modules/gdal3.js/dist/package/{gdal3WebAssembly.data,gdal3WebAssembly.wasm,gdal3.js} lib",

"build:prod": "jlpm run clean && jlpm run build",
"build:dev": "tsc -b && jlpm run cp:gdal",
"clean": "rimraf tsconfig.tsbuildinfo",
Expand Down
7 changes: 4 additions & 3 deletions packages/base/src/gdal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import initGdalJs from 'gdal3.js';
export async function getGdal() {
const dataurl = new URL('./gdal3WebAssembly.data', import.meta.url);
const wasmurl = new URL('./gdal3WebAssembly.wasm', import.meta.url);
const jsurl = new URL('./gdal3.js', import.meta.url);

// TODO Pass gdal JS too and run gdal in a worker?
return await initGdalJs({
paths: {
wasm: wasmurl.href,
data: dataurl.href
data: dataurl.href,
js: jsurl.href
},
useWorker: false
useWorker: true
});
}

Expand Down
Loading