[PostGIS] #5777: st_intersects() throws exception when using geometrycollection as first argument
PostGIS
trac at osgeo.org
Tue Sep 3 05:33:04 PDT 2024
#5777: st_intersects() throws exception when using geometrycollection as first
argument
-------------------------------------------------+-------------------------
Reporter: cfischer | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS
| 3.4.3
Component: postgis | Version: 3.4.x
Keywords: relate st_intersects |
TopologyException |
-------------------------------------------------+-------------------------
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
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5777>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list