3 ms·
Very nice! I wonder if I can compile this to wasm. I’ve been badly needing spatial predicates in a web environment that are faster and less clunky than JSTS. D
by Waterluvian 3y ago
Very nice! I wonder if I can compile this to wasm. I’ve been badly needing spatial predicates in a web environment that are faster and less clunky than JSTS.
Does it assume a flat Cartesian world or does it handle ellipsoids or even map projections? (Or does it avoid the complexity altogether by not doing any work that cares about distances?)
- deleted 3y ago[deleted]
- simonw 3y agoYeah a WASM build of this would be fantastic. It looks like it's a very clean C codebase so I expect getting it working in WASM would be relatively straightforward.
- o11c 3y agoEllipsoids don't have a well-defined answer to what is "inside" or "outside" the asylum.
- crabmusket 3y agoAre there any other libraries in the browser space that implement polygon Boolean operations other than JSTS? I've tried martinez-polygon-clipping, polygon-clipping, and polyclip-ts, all of which are based on the same algorithm, and all of which seem to throw exceptions frequently on geometry with overlapping edges. I'm thinking I'll need to dig into JSTS in the hope it'll prove more stable... or learn how to write these kinds of algorithms myself.
- kylebarron 3y agoI'm working on bringing GeoRust algorithms [0] (which include boolean operations) to the web via WebAssembly. See this blog post [1] for an intro. There's also separate work on binding GEOS to Wasm [2], but I'm more excited about GeoArrow in the long term because you can interpret Wasm geometries in JS without any copies across the boundary [3]. [0]: https://docs.rs/geo/latest/geo/#algorithms https://docs.rs/geo/latest/geo/#algorithms [1]: https://observablehq.com/@kylebarron/prototyping-georust-geoarrow-in-webassembly https://observablehq.com/@kylebarron/prototyping-georust-geo... [2]: https://github.com/chrispahm/geos-wasm https://github.com/chrispahm/geos-wasm [3]: https://observablehq.com/@kylebarron/zero-copy-apache-arrow-with-webassembly https://observablehq.com/@kylebarron/zero-copy-apache-arrow-...
- crabmusket 3y agoOh I've read [3] before, that's very exciting! I'll be following your RSS feed :)
- Tanjreeve 3y agoI would assume it's flat A) if you're handling projections or doing geodesic geometry then there's a bunch of other stuff to do and you'd probably have to mention it. B) it would be obvious in the codebase if that was a part of it there'd be mentions of projections or some sort of constants for spherical maths. C) Projections etc are often very application specific afaik it's not really possible to generalise it safely.