Opened 5 months ago

Last modified 4 months ago

#5640 new defect

ST_Covers 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 IF EXISTS origin; 
CREATE TABLE origin (id int, geom geometry, valid boolean, gRelate int);
INSERT INTO origin (id, geom) VALUES (1, ST_LineFromText('LINESTRING(75 15,55 43)',0));
INSERT INTO origin (id, geom) VALUES (2, ST_LineFromText('LINESTRING(75 15,55 43)',0)); 
INSERT INTO origin (id, geom) VALUES (3, ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOLYGON EMPTY,LINESTRING(75 15,55 43))',0)); 
SELECT a1.id, a2.id         FROM origin As a1          JOIN origin As a2 ON ST_Covers(a1.geom, a2.geom)          WHERE   a1.id <> a2.id;
-- actual {1,2; 2,1; 3,1; 3,2}; expected {1,2; 2,1; 3,1; 3,2; 1,3; 2,3}

The 1st geometry covers the 3rd one, because each point in 3st geometry lies inside 1st one, according to the definition of ST_Covers

Returns true if every point in Geometry/Geography B lies inside (i.e. intersects the interior or boundary of) Geometry/Geography A.

and the following statement result:

SELECT ST_Covers(a1.geom, a2.geom) FROM origin As a1, origin As a2 WHERE a1.id = 1 and a2.id = 3;
-- result{t}

However, PostGis missed the pairs of 1,3 and 2,3.

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 (2)

comment:2 by pramsey, 4 months ago

Milestone: PostGIS 3.4.2PostGIS GEOS
Note: See TracTickets for help on using tickets.