We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The union_all feature produces a MultiLineString with not 2 but 3 LineStrings.
from shapely import LineString, union_all geoms = [ LineString([ (355041.15, 6688781.25, 0), (355040.9629213488, 6688781.437078651, 9.7) ]), LineString([ (355041.1500000001, 6688781.25, 0), (354841.1500000001, 6688781.25, 0) ]) ] result = union_all(geoms) assert len(result.geoms) == len(geoms), "Bug"
Ubuntu 22.04.4 LTS (x86_64)
2.0.3
The text was updated successfully, but these errors were encountered:
I think your code sample isn't ideal, as the lines don't have a common point, but you are right anyway that union_all doesn't union/merge lines.
union_all
Not sure why this is split up (I asked if it is intentional here libgeos/geos#1063), but to union/merge lines you need to use shapely.line_merge:
from shapely import LineString, MultiLineString, line_merge, union_all geoms = [ LineString([ (355041.15, 6688781.25, 0), (355040.9629213488, 6688781.437078651, 9.7) ]), LineString([ (355041.15, 6688781.25, 0), (354841.1500000001, 6688781.25, 0) ]) ] line_merge_result = line_merge(MultiLineString(geoms)) print(line_merge_result) # LINESTRING Z (354841.1500000001 6688781.25 0, 355041.15 6688781.25 0, 355040.9629213488 6688781.437078651 9.7) union_all_result = union_all(geoms) print(union_all_result) # MULTILINESTRING Z ((355041.15 6688781.25 0, 355040.9629213488 6688781.437078651 9.7), (355041.15 6688781.25 0, 354841.1500000001 6688781.25 0))
Sorry, something went wrong.
No branches or pull requests
Please note
Expected behavior and actual behavior.
The union_all feature produces a MultiLineString with not 2 but 3 LineStrings.
Steps to reproduce the problem.
Operating system
Ubuntu 22.04.4 LTS (x86_64)
Shapely version and provenance
2.0.3
The text was updated successfully, but these errors were encountered: