Opened 14 months ago

Last modified 11 months ago

#5580 closed defect

ST_3DIntersects fails when encouting a GEOMETRYCOLLECTION with an empty geometry — at Version 5

Reported by: Wenjing Owned by: pramsey
Priority: high Milestone: PostGIS 3.3.6
Component: postgis Version: 3.4.x
Keywords: Cc:

Description (last modified by Wenjing)

Consider this query:

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}

When using the 2D Intersects function in this situation, the expected result is true because POINT(0 0) is the two geometries' intersection. PostGIS returns true.

But consider its 3D version:

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}

POINT Z (0 0 0) is the two geometries' intersection. So the excepted result of 3DIntersects is true.

But the 3DIntersects function doesn't consider they intersect only when inserting an empty geometry before this point.

Change History (5)

comment:1 by Wenjing, 14 months ago

Description: modified (diff)
Priority: mediumhigh

comment:2 by Wenjing, 14 months ago

Description: modified (diff)

comment:3 by Wenjing, 14 months ago

Summary: When encounting an empty geometry, potential bug in the ST_3DIntersects functionST_3DIntersects fails when encouting a GEOMETRYCOLLECTION with an empty geometry

comment:4 by Wenjing, 14 months ago

The potential solution is to add some same condition detection in the ST_Intersects function to ST_3DIntersects.🤔

comment:5 by Wenjing, 14 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.