JuliaGeo / LibGEOS.jl

Julia package for manipulation and analysis of planar geometric objects
MIT License
72 stars 23 forks source link

Concave hull with holes #181

Open Wikunia opened 1 year ago

Wikunia commented 1 year ago

I just came across this library and I'm interested in the concave hull functionality of LibGEOS. Looks like there are some C calls implemented for this but I'm unsure how they can be used as there isn't a function like concavehull as one exists for convexhull.

Can the concave hull functionality be used already or does it need some more work and the functions like GEOSConcaveHull are just the preparation step?

visr commented 1 year ago

Yes, the functions in src/generated/libgeos_api.jl and we generally wrap them in geos_functions.jl to offer a nicer API. And like you mention for GEOSConcaveHull that hasn't been done yet. That doesn't mean it cannot be used directly though. Contributions like this are always welcome.

https://github.com/JuliaGeo/LibGEOS.jl/blob/5439a4546f7733c59a85f056a120d77bf3d4f4cf/src/generated/libgeos_api.jl#L642-L649

https://github.com/JuliaGeo/LibGEOS.jl/blob/5439a4546f7733c59a85f056a120d77bf3d4f4cf/src/geos_functions.jl#L668-L674

So if you have a GEOS geometry object, you can get its context from get_context(obj), and pass both into the low-level function. The geomFromGEOS function converts the pointer we get back from GEOS into a geometry type.

visr commented 1 year ago

Similarly GEOSConcaveHullByLength needs to be wrapped, this came up in #182.