Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffering a polygon results in an empty polygon #200

Open
pilifly opened this issue Jan 22, 2024 · 1 comment
Open

buffering a polygon results in an empty polygon #200

pilifly opened this issue Jan 22, 2024 · 1 comment

Comments

@pilifly
Copy link

pilifly commented Jan 22, 2024

buffering a polygon by -0.05 created an empty polygon.

libgeos_error
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)

@pilifly pilifly changed the title buffering a polygon resulting in an empty polygon buffering a polygon results in an empty polygon Jan 22, 2024
@jaakkor2
Copy link
Contributor

Depending on your requirements, you could consider simplifying the poly before buffering

buffered_poly = LibGEOS.buffer(simplify(poly, abs(dist)), dist, 40)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants