-
Notifications
You must be signed in to change notification settings - Fork 560
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
Line Intersection produces a point which results in invalid value in line_locate_point #1796
Comments
Issue confirmed with from shapely import geos, wkt
print(geos.geos_version_string)
A = wkt.loads("LINESTRING (0 0, 1 1, 1 1, 2 2)")
B = wkt.loads("POINT (0 1)")
print(A.project(B))
The issue is the coordinate that has repeated XY coords giving a zero segment distance in 2d (Z dim is ignored). The issue is likely deep within C++ of the GEOS library. |
Just to be clear, the "invalid value" is only a warning (that needs to be avoided/suppressed in GEOS). But is the actual result correct? |
@jorisvandenbossche yes the value is correct. I meant to say that it produces the warning invalid value in line_locate_point. @mwtoews is right, it ignores the Z dimension. Perhaps duplicate 2d coordinates are not allowed in GEOS |
Would it be possible from within shapely to expose a bit more of the stack trace? I see the same warning but it only shows the part of the stack trace which is related to shapely and not the rest of the stack trace which would be helpful to direct me to the place in MY code where the warning is related to. If this is possible it would be easier to check if the result is still valid despite the warning. |
@mwtoews are you able to reproduce this in GEOS directly? |
Hmm, I'm not seeing much with:
|
This was fixed with GEOS 3.12.0. While I'm not sure which commit was the fix, I've added a test for it libgeos/geos@34b29f8 |
Expected behavior and actual behavior.
Creating an intersection point of a river cross-section [LineString with Z values] with the river [LineString 2D]
and then projecting the intersection point on the same river cross-section produces invalid value in line_locate_point.
Coordinates of river:
Coordinates of cross-section:
Steps to reproduce the problem.
(For example, a script with required data)
Operating system
Windows 10
Shapely version and provenance
2.0.1 from PyPI using pip
The text was updated successfully, but these errors were encountered: