geos-wasm icon indicating copy to clipboard operation
geos-wasm copied to clipboard

geos-wasm - Is it worth the effort?

Open chrispahm opened this issue 2 years ago • 3 comments

Hi @tmcw!

I saw this repo last week, and thought it's a great idea to have access to GEOS in JS! So, after playing around with this for a bit, I finally managed to get the general concept to work: https://github.com/chrispahm/geos-wasm#geos-wasm Demo → https://chrispahm.github.io/geos-wasm/

Right now, it's just the buffer function, but after working on it I felt like there should be a general discussion first whether a) the implementation even makes sense b) whether we'd expect the benefits of this to outweigh the overall effort. I wrote most of my findings in the Background section of the readme (https://github.com/chrispahm/geos-wasm#background), so if you have a minute I'd appreciate your feedback!

Best, Christoph

chrispahm avatar Jun 27 '23 14:06 chrispahm

I wrote down some thoughts in a blog post: https://kylebarron.dev/blog/geos-wasm 🙂

kylebarron avatar Jun 30 '23 14:06 kylebarron

Had drafted a reply but forgot to hit send, it looks like…

Thanks for actually diving in and actually writing some code! This is definitely in that zone of unknown variables in which it's much more useful to speculate once we've at least tried to get it started.

Basically, I totally agree with what you and Kyle have both written: geos-wasm wouldn't necessarily be smaller, faster, or simpler than Turf or existing JavaScript libraries. And it'd probably be a lot of work.

Like Kyle, I'm pretty optimistic / excited about georust, but at the same time, certain issues like buffering & intersection can be a sort of excalibur’s sword in which a solution doesn't really arise organically over time - it requires a lot of time & dedication to implement these things correctly. It might take years for the people & resources to arrive. Whereas geos-wasm might be more of a known effort: it's hard to write WASM bindings, but it's an integration problem rather than a mathematical geometric engineering one.

tmcw avatar Jul 10 '23 18:07 tmcw

Thanks for the replies! I also agree with Kyle that georust is probably the way forward, especially after seeing his demo: https://observablehq.com/@kylebarron/prototyping-georust-geoarrow-in-webassembly

Despite this, I still updated the geos-wasm to include all GEOS functions, since it felt like an unfinished project. It's a 2.3 MB package now, but I still think it may have some use cases until geoarrow is ready. There are no wrapper functions anymore, just the barebones C-API. The API Documentation has a few examples, and there's also quite a few tests.

chrispahm avatar Jul 26 '23 12:07 chrispahm