parallel_offset returns MultiString with missing parts
See original GitHub issueHi,
I’m noticing strange behavior in the parallel_offset method.
Expected behavior and actual behavior.
parallel_offset should return a single LineString in the following example but returns a MultiLineString with a part missing. Works correctly for some other distances or side=‘left’ or when removing one of the points.
incorrect behavior for distance=10 correct behavior for distance=8
Steps to reproduce the problem.
import shapely.wkt
from matplotlib import pyplot as plt
from shapely.geometry import LineString
road = shapely.wkt.loads('LINESTRING ('
'424367.2267078362 4513099.023495375,'
' 424370.9561004792 4513098.974304576,'
' 424380.476033291 4513098.832676926,'
' 424382.1039646821 4513098.816053259'
')')
plt.plot(*road.coords.xy, marker='o')
line = road.parallel_offset(distance=10, side='right')
if isinstance(line, LineString):
line = [line]
for l in line:
plt.plot(*l.coords.xy, marker='o')
plt.gca().set_aspect('equal')
plt.show()
Operating system
Mac OS X 10.14.5
Shapely version and provenance
1.6.4.post1 installed from Conda
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
parallel_offset returns MultiString with missing parts · Issue #746
Hi,. I'm noticing strange behavior in the parallel_offset method. Expected behavior and actual behavior. parallel_offset should return a ...
Read more >shapely parallel_offset robustness - GIS Stack Exchange
polygon.LinearRing instance Returns a LineString or MultiLineString geometry at a distance from the object on its right or its left side.
Read more >shapely parallel_offset sometimes does not generate closed ring
I am using the parallel_offset function of the shapely package to get offset structures to some polygons that are closed rings.
Read more >The Shapely User Manual — Shapely 2.0.0 documentation
Returns a string specifying the Geometry Type of the object in accordance with 1. >>> from shapely import Point, LineString ...
Read more >Conduit Bending: Parallel Offsets, How to calculate ... - YouTube
In this video I show you how to find the parallel adjustment constants and how to implement them in your offsets to create...
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
A link to the ticket in the geos bug tracker: https://trac.osgeo.org/geos/ticket/806
Using the latest released shapely and GEOS versions, this is now working correctly (the offset curve implementation has been refactored):