Opened 5 months ago
Closed 4 months ago
#5751 closed defect (invalid)
Problem with ST_Intersection
Reported by: | ezimanyi | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.4.3 |
Component: | postgis | Version: | 3.4.x |
Keywords: | Cc: |
Description
test=# select st_intersects(geometry 'Linestring(1 1,1 1)', geometry 'Linestring(1 1,3 3)'); st_intersects --------------- t (1 row) test=# select st_astext(st_intersection(geometry 'Linestring(1 1,1 1)', geometry 'Linestring(1 1,3 3)')); st_astext ------------------ LINESTRING EMPTY (1 row)
Change History (5)
comment:1 by , 5 months ago
follow-up: 4 comment:3 by , 5 months ago
This is a design choice made in the JTS/GEOS intersection algorithm, about how to handle invalid degenerate lines.
The overlay algorithm is designed to never provide invalid output. Rightly or wrongly, zero-length lines are considered to be invalid. But perhaps it would be better to treat them as valid (or mostly valid - i.e. only if they occur in the input.)
I'm not sure how hard it would be to provide this semantic.
comment:4 by , 5 months ago
Replying to mdavis:
This is a design choice made in the JTS/GEOS intersection algorithm, about how to handle invalid degenerate lines.
The overlay algorithm is designed to never provide invalid output. Rightly or wrongly, zero-length lines are considered to be invalid. But perhaps it would be better to treat them as valid (or mostly valid - i.e. only if they occur in the input.)
I'm not sure how hard it would be to provide this semantic.
I would say probably not worth changing.
@ezimanyi is this issue inconveniencing you a lot?
comment:5 by , 4 months ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I have replicated the issue. I'm guessing the issue is because linestring 1 is a degenerate linestring. I'm honestly not sure what the answer should be to the intersection question.