geoarrow / geoarrow-rs

GeoArrow in Rust, Python, and JavaScript (WebAssembly) with vectorized geometry operations
http://geoarrow.org/geoarrow-rs/
Apache License 2.0
254 stars 17 forks source link

JS: how to handle scalars? #114

Closed kylebarron closed 1 year ago

kylebarron commented 1 year ago

E.g. in algorithms like contains and euclidean_distance where you want to broadcast against a single scalar

kylebarron commented 1 year ago

Well, I thought that https://github.com/kylebarron/geoarrow-rs/pull/119 was going to solve this, but it still might not out of the box because wasm-bindgen doesn't support any lifetime specifiers

I think the best way forward is to have equivalent storage in structs in the JS bindings, and just convert to/from geoarrow scalar structs.

kylebarron commented 1 year ago

Note that Python doesn't support lifetimes either, so Python will need the same stuff: https://pyo3.rs/v0.19.2/class#no-lifetime-parameters