[PostGIS] #5634: ST_Contains missed one of the pairs
PostGIS
trac at osgeo.org
Fri Dec 1 18:41:45 PST 2023
#5634: ST_Contains missed one of the pairs
---------------------+---------------------------
Reporter: Wenjing | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.4.2
Component: postgis | Version: 3.4.x
Keywords: |
---------------------+---------------------------
Consider the following statements:
{{{
DROP table t;
CREATE table t (id int, geom geometry);
INSERT INTO t (id, geom) VALUES
(1,ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOINT((-60 -50),(-63
-49)))'));
INSERT INTO t (id, geom) VALUES
(2,ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOINT((-60 -50),(-63
-49)))'));
INSERT INTO t (id, geom) VALUES (3,ST_GeomFromText('MULTIPOLYGON(((-60
-50,-70 -50,-60 -40,-60 -50)))'));
SELECT a1.id, a2.id FROM t As a1, t As a2 WHERE ST_Contains(a1.geom,
a2.geom) and a1.id <> a2.id;
-- actual{1,2; 2,1; 3,1 }
-- expected{1,2; 2,1; 3,1; 3,2 }
}}}
It is noticed that the first geometry and the second geometry are equal,
which means if the third geometry contains the first one, the third one
contains the second as well.
However, when querying the Contains pairs, besides reporting that the
first and second geometries contain each other (1,2; 2,1), PostGIS just
answers that the third geometry contains the first geometry (3,1), instead
of both the first and the second geometries (3,1;3,2), which seems a bug.
The version is the newest on
[GitHub](https://trac.osgeo.org/postgis/wiki/GitHub):
{{{
POSTGIS="3.5.0dev 3.4.0rc1-818-g6c2e935b6" [EXTENSION] PGSQL="170"
GEOS="3.13.0dev-CAPI-1.18.0" PROJ="8.2.1
NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org/
USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/
share/proj/proj.db" LIBXML="2.9.13"
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5634>
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