Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST_Covers missed one of the pairs. #36

Open
cuteDen-ECNU opened this issue Dec 7, 2023 · 1 comment
Open

ST_Covers missed one of the pairs. #36

cuteDen-ECNU opened this issue Dec 7, 2023 · 1 comment
Labels
bug-confirm libgeos sytax trans Add point to the boundary of geometry

Comments

@cuteDen-ECNU
Copy link
Owner

cuteDen-ECNU commented Dec 7, 2023

Consider the following statements:

DROP TABLE IF EXISTS origin; 
CREATE TABLE origin (id int, geom geometry);
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:

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"
@cuteDen-ECNU
Copy link
Owner Author

bugtracker link: https://trac.osgeo.org/postgis/ticket/5640

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-confirm libgeos sytax trans Add point to the boundary of geometry
Projects
None yet
Development

No branches or pull requests

1 participant