Jaakko Ruohio

Results 53 comments of Jaakko Ruohio

I see this crashing as well. Here is a bit simpler example that crashes every time I run it (Julia 1.7.1, GEOS_jll 3.10.0+0, LibGEOS.jl 0.6.8) ``` using LibGEOS function findintersecting(g1,...

Even simpler crasher ``` import LibGEOS function cra(n) p = [[[-1.,-1],[+1,-1],[+1,+1],[-1,+1],[-1,-1]]] g1 = [LibGEOS.Polygon(p) for i=1:n] r = fill(false, n, n) Threads.@threads for i=1:n for j=1:n r[i,j] = LibGEOS.intersects(g1[i],g1[j]) end...

> @jaakkor2, about [#91 (comment)](https://github.com/JuliaGeo/LibGEOS.jl/issues/91#issuecomment-1003350071) > > I haven't tried threading yet, but I thought the idea of the `_r` functions that take a `GEOSContext` is that you create a...

This still crashes ``` import LibGEOS ctx = [LibGEOS.GEOSContext() for i=1:Threads.nthreads()] function cra(n, ctx) p = [[[-1.,-1],[+1,-1],[+1,+1],[-1,+1],[-1,-1]]] g1 = [LibGEOS.Polygon(p) for i=1:n] r = fill(false, n, n) Threads.@threads for i=1:n...

If `Threads.@threads` is in front of the inner for loop, then this seems to work 🤷 ``` import LibGEOS ctx = [LibGEOS.GEOSContext() for i=1:Threads.nthreads()] function cra(n, ctx) p = [[[-1.,-1],[+1,-1],[+1,+1],[-1,+1],[-1,-1]]]...

Crashes for me with LibGEOS v0.7.2 and GeoInterface v1.0.1 if i start Julia with `--threads 4`, does not crash if started without threads.

In the example, `coord_lst` is sharing the memory of `coord`. With this it seems to work `coord_lst = [copy(coord) for i=1:5]`.

Yes, doable. `LibGEOS.GEOSMakeValid_r` returns a pointer, maybe one should convert to Julia type based on `LibGEOS.geomTypeId` as the type of the output depends on the input. ``` makeValid(g) = LibGEOS.GEOSMakeValid_r(LibGEOS._context.ptr,...

Tests could come from https://github.com/libgeos/geos/blob/main/tests/unit/capi/GEOSMakeValidTest.cpp There seems to be functions not yet wrapped `GEOSMakeValidParams_create`, `GEOSMakeValidParams_setKeepCollapsed`, `GEOSMakeValidWithParams`, ... . Maybe just one user-facing function `makeValid` and keyword arguments for parameters.

`LibGEOS.geomFromGEOS` is the function to go from GEOS to geom. Better one-liner ``` makeValid(g) = LibGEOS.geomFromGEOS(LibGEOS.GEOSMakeValid_r(LibGEOS._context.ptr, g.ptr)) ```