Opened 2 months ago

Last modified 2 months ago

#5777 new defect

st_intersects() throws exception when using geometrycollection as first argument — at Initial Version

Reported by: cfischer Owned by: pramsey
Priority: medium Milestone: PostGIS 3.4.4
Component: postgis Version: 3.4.x
Keywords: relate st_intersects TopologyException Cc: cfischer

Description

PostGIS throws an exception with st_intersects on geometry collection as first parameter

SQL Error [XX000]: ERROR: GEOSIntersects: TopologyException: side location conflict at 725217.59322033904 6176386.5423728814. This can occur if the input geometry is invalid.

A have isolated the problem, shown below. The order of the arguments to st_intersects appears to be signifikant.

  • geom_1 : is a point
  • geom_2 : is a geometrycollection, containing two triangles
  • geom_3 : is a multipolygon-version of geom_2
  • st_intersects (geom_1, geom_2) -> SUCCESS
  • st_intersects (geom_2, geom_1) -> FAILS
  • st_intersects (geom_1, geom_3) -> SUCCESS
  • st_intersects (geom_3, geom_1) -> SUCCESS
WITH geom_1 AS (
  SELECT st_point(725220, 6176385, 25832) AS geom
),
geom_2 AS (
  SELECT
    st_geometryfromtext(
      'GEOMETRYCOLLECTION (
        POLYGON ((725210 6176386, 725220 6176382, 725224 6176387, 725210 6176386)),
        POLYGON ((725215 6176390, 725218 6176386, 725225 6176385, 725215 6176390))
      )'
    , 25832) AS geom
),
geom_3 AS (
  SELECT
    st_geometryfromtext(
      'MULTIPOLYGON (
                ((725210 6176386, 725220 6176382, 725224 6176387, 725210 6176386)),
                ((725215 6176390, 725218 6176386, 725225 6176385, 725215 6176390))
      )'
    , 25832) AS geom
)
SELECT
  *
FROM
  geom_1
  JOIN geom_2 ON (st_intersects(geom_2.geom, geom_1.geom)) -- fails
--  JOIN geom_2 ON (st_intersects(geom_1.geom, geom_2.geom)) -- works
--  JOIN geom_3 ON (st_intersects(geom_1.geom, geom_3.geom)) -- works
--  JOIN geom_3 ON (st_intersects(geom_3.geom, geom_1.geom)) -- works

Change History (0)

Note: See TracTickets for help on using tickets.