ST_3DIntersects fails when encouting a GEOMETRYCOLLECTION with an empty geometry
— at Version 7
Consider this query:
SELECT
ST_3DIntersects(a1, a2)
FROM ST_GeomFromText('GEOMETRYCOLLECTION Z (POINT Z EMPTY, POINT Z (0 0 0))') As a1
, ST_GeomFromText('POINT Z (0 0 0)') As a2;
--expected{t}; actual{f}
Postgis produces a result of false, but I expected it to produce true. I think this is a bug, due to the following 3 reasons:
- ST_3DIntersection(a1, a2) returns POINT Z (0 0 0). So the expected result of 3DIntersects is true.
- Considering the 2D version function, ST_Intersects(a1, a2) returns true here:
SELECT
ST_Intersects(a1, a2)
FROM ST_GeomFromText('GEOMETRYCOLLECTION(POINT EMPTY, POINT (0 0))') As a1
, ST_GeomFromText('POINT (0 0)') As a2;
--expected{t}
- Making the empty point position behind POINT Z (0 0 0), ST_3DIntersection(a1, a2) returns true.
Change History
(7)
Description: |
modified (diff)
|
Priority: |
medium → high
|
Description: |
modified (diff)
|
Summary: |
When encounting an empty geometry, potential bug in the ST_3DIntersects function → ST_3DIntersects fails when encouting a GEOMETRYCOLLECTION with an empty geometry
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
The potential solution is to add some same condition detection in the ST_Intersects function to ST_3DIntersects.🤔