Unexpected behavior of buffer with LinearRing object
See original GitHub issueExpected behavior and actual behavior.
Maybe I’m using the LinearRing in an unsupported fashion, but when I use LinearRing.buffer
I get more vertices than expected around the first (identical to the last since it’s a ring) input vertex.
Steps to reproduce the problem.
# define an equilateral triangle as LinearRing (just to make sure than all three corners are comparable
lr = shapely.geometry.LinearRing([[0, 0],
[50, (100**2-50**2)**0.5],
[100, 0]])
print(lr.is_closed) # is closed as expected
print(list(lr.coords)) # the three given coordinates plus the closing [0, 0]
lr_buffered = lr.buffer(2, 2)
print(list(lr_buffered.exterior.coords)) # UNEXPECTED: more vertices than expected around [0, 0]
The output for the last print
is a mess, but let me describe it here:
- 4 vertices around the first input vertex.
- 4 vertices around the second input vertex.
- 4 vertices around the third input vertex.
- Another 8 vertices around the fourth/first input vertex.
Operating system
Linux manjaro 5.3.7-2-MANJARO SMP PREEMPT Tue Oct 22 18:56:05 UTC 2019 x86_64 GNU/Linux
Shapely version and provenance
1.6.4.post2 installed from PyPI using pip
Thanks for your work on shapely and for looking into this issue.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Unexpected behavior of buffer with LinearRing object #790
Maybe I'm using the LinearRing in an unsupported fashion, but when I use LinearRing.buffer I get more vertices than expected around the first...
Read more >Unexpected behavior of collect() in geometry generator
I'm having unexpected results using geometry generator with the following expression: buffer(collect($geometry),0).
Read more >Shapely Documentation - Read the Docs
Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects. It is using.
Read more >Shapely and geometry objects - Automating GIS Processes
Shapely and geometry objects#. In this lesson, you will learn how to create and manipulate geometries in Python using the Shapely Python Package....
Read more >Solved: Buffer tool with parameters - Esri Community
Solved: Hi - I've been trying to implement some of the code samples that use the drawing toolbar, along with buffer parameters and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m going to close this one. GEOS 3.10.x is making its way into distributions of shapely.
With latest Shapely and GEOS (3.10.1), I get the expected result (4 vertices in each corner):