#5634 closed defect (fixed)
ST_Contains missed one of the pairs
Reported by: | Wenjing | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS GEOS |
Component: | postgis | Version: | 3.4.x |
Keywords: | Cc: |
Description
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"
Change History (4)
comment:1 by , 11 months ago
comment:3 by , 11 months ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed with GEOS 3.13, 3.12.2, 3.11.4, 3.10.7
comment:4 by , 11 months ago
Milestone: | PostGIS 3.4.2 → PostGIS GEOS |
---|
This is probably a mistake in GEOS PreparedContains, since the PostGIS caching system is doing the first test with Contains and the second (cached) with PreparedContains