Process multi-dimensional arrays on webassembly, need a road map

I am new to rust and webassembly.
I need to process multi dimensional arrays on wasm for geographical information system analysis.(slope analysis, image filtering).
The project will grow if I can reach good enough speed with low wasm size. Clustering algorithms would be next.
Which crates suit the needs? Any source puts me in the path is wellcome!

What have you looked into so far?

For manipulating generic N-dimensional arrays you can use ndarray or the ncollide project.

You might also want to search for relevant keywords like "gis" on

1 Like

I found image and ndarray crate, both of them supports data structure for arrays.

I need to do convolution for filtering, image has imageproc which looks helpful.

I found ocl_convolution on ndarray side. It uses opencl. I am not sure wrapped crates from other languages is good choice for webassembly. Does they cause problems when compiling wasm?

I found rayon for parallelism. Rayon should work on webasembly too. I should consider parallelism support of crates.

I need to calculate visible lands in the range of an observer. No idea about efficient algorithms on that right now. Convex, concave calculations might be a stage on the process.

Edit: Also came across basic_dsp.

You can just try it for yourself. Create a dummy cargo project, add the crates as dependencies in Cargo.toml, then run cargo build --target wasm32-unknown-unknown (or wasm-pack build).

Otherwise, I can give you a single data point: in my experience, ndarray itself supports compilation to wasm, but ndarray-stats doesn't work with the wasm32-unknown-unknown target (it requires wasm32-wasi), so it won't work with wasm-bindgen. It simply refuses to compile, it won't cause mysterious runtime errors.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.