LibGEOS.jl
LibGEOS.jl copied to clipboard
buffering a polygon results in an empty polygon
buffering a polygon by -0.05 created an empty polygon.
using LibGEOS
points =
[[-1.980000000392857, -1.1200595222536243],
[-1.9707179676972442, -1.1547005387729528],
[1.9600000000000004, -1.1547005387729532],
[1.9853589842420483, -1.1293415545453502],
[0.020000000340954713, 2.274760060803972],
[-0.014641016121955817, 2.284042093302481],
[-1.980000000392857, -1.1200595222536243]]
poly = LibGEOS.Polygon([points])
dist = -0.05
buffered_poly = LibGEOS.buffer(poly, dist, 40)
@test !LibGEOS.isEmpty(buffered_poly)
Note: test passed when reducing dist to -0.005
dist = -0.005
buffered_poly = LibGEOS.buffer(poly, dist, 40)
@test !LibGEOS.isEmpty(buffered_poly)
Depending on your requirements, you could consider simplify
ing the poly before buffering
buffered_poly = LibGEOS.buffer(simplify(poly, abs(dist)), dist, 40)