-
Notifications
You must be signed in to change notification settings - Fork 399
Open
Labels
Description
Considering the following statement:
SELECT ST_Covers(g2, g1), ST_Covers(g3, g1) FROM
(SELECT
ST_GeomFromText('GEOMETRYCOLLECTION ( LINESTRING (1 2, 1 1), POINT (0 0))') As g1
, ST_GeomFromText(' MULTIPOLYGON (((0 0, 3 0, 3 3, 0 3, 0 0))) ') As g2
, ST_GeomFromText(' POLYGON ((0 0, 3 0, 3 3, 0 3, 0 0)) ') As g3
);
-- expected: {true, true}; actual: {false, true}The 2nd geometry covers the 1st one, because each point in the 1st geometry lies inside the 2nd one, according to the definition of ST_Covers:
ST_Covers(A, B) ⇔ A ⋂ B = B
However, PostGIS doesn't consider the ST_Covers relation, which seems to be a bug. After normalizing MULTIPOLYGON to POLYGON as g3, ST_Covers(g3, g1) gives the correct answer.
Here is a simple reproduction for libgeos:
bin/geosop -a 'GEOMETRYCOLLECTION ( LINESTRING (1 2, 1 1), POINT (0 0))' -b 'MULTIPOLYGON (((0 0, 3 0, 3 3, 0 3, 0 0)))' covers
# falsegeos version is the latest one in GitHub:
6f70b63