JuliaGeo / LibGEOS.jl

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

Problem with the "difference" function #177

Closed DiracM closed 1 year ago

DiracM commented 1 year ago

I was experimenting with the LibGEOS.jl package and I was trying to remove a smaller circle from a larger one. For that I have used the function "difference" without success. The output its almost identical to the bigger circle. I wonder what could be causing this issue. The code to replicate the issue is the following:

using LibGEOS

p1 = LibGEOS.Point(0.0,0.0) p2 = LibGEOS.Point(0.0,0.0)

c1 = LibGEOS.buffer(p1, 2) c2 = LibGEOS.buffer(p2, 1)

plot(LibGEOS.difference(c1,c2))

jaakkor2 commented 1 year ago

You did not specify which plotting system you are using. This works

using LibGEOS
using GLMakie
using GeoInterfaceMakie
GeoInterfaceMakie.@enable(LibGEOS.AbstractGeometry)

p1 = LibGEOS.Point(0.0,0.0)
p2 = LibGEOS.Point(0.0,0.0)

c1 = LibGEOS.buffer(p1, 2)
c2 = LibGEOS.buffer(p2, 1)

plot(LibGEOS.difference(c1,c2))

If you used Plots.jl, there is an old open issue https://github.com/JuliaPlots/Plots.jl/issues/972 .

DiracM commented 1 year ago

Jaakor you are 100% correct on the Plots issue and the alternative that you suggested for the visualization does works. I couldn't ask for more, thank you.