Opened 9 months ago

Closed 6 months ago

#5674 closed defect (worksforme)

ST_CoveredBy(geography, geography) not working for covered polygon with hole

Reported by: dbiernacka Owned by: pramsey
Priority: medium Milestone: PostGIS 3.2.8
Component: postgis Version: 3.4.x
Keywords: Cc:

Description

Following statement returns false for covered polygon with hole

select ST_CoveredBy(
  ST_GeographyFromText('POLYGON ((3.845215 46.407564, 3.845215 47.886881, 7.097168 47.886881, 7.097168 46.407564, 3.845215 46.407564), (6.569824 46.980252, 5.822754 46.860191, 6.28418 47.561701, 6.569824 46.980252))'),
  ST_GeographyFromText('POLYGON ((1.120605 45.383019, 1.120605 48.661943, 8.657227 48.661943, 8.657227 45.383019, 1.120605 45.383019))')
)

Case when covering polygon contains hole returns true as expected. Function ST_CoveredBy with geometry parameters returns true as expected.

Tested on versions:

POSTGIS="3.2.3 2f97b6c" [EXTENSION] PGSQL="140" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY

POSTGIS="3.5.0dev 3.4.0rc1-775-g86e698565" [EXTENSION] PGSQL="150" GEOS="3.13.0dev-CAPI-1.18.0" PROJ="9.4.0 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj DATABASE_PATH=/usr/local/share/proj/proj.db" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" TOPOLOGY

Change History (5)

comment:1 by robe, 9 months ago

Milestone: PostGIS 3.2.8

comment:2 by robe, 9 months ago

I just tested this and it returns true for me:

select ST_CoveredBy(
  ST_GeographyFromText('POLYGON ((3.845215 46.407564, 3.845215 47.886881, 7.097168 47.886881, 7.097168 46.407564, 3.845215 46.407564), (6.569824 46.980252, 5.822754 46.860191, 6.28418 47.561701, 6.569824 46.980252))'),
  ST_GeographyFromText('POLYGON ((1.120605 45.383019, 1.120605 48.661943, 8.657227 48.661943, 8.657227 45.383019, 1.120605 45.383019))')
)
st_coveredby
--------------
 t
(1 row)

Are you sure this was the example you meant to post?

comment:3 by dbiernacka, 9 months ago

Surely it returns false for me. It is reproducible also in dbfiddle https://dbfiddle.uk/?rdbms=postgres_14

comment:4 by robe, 9 months ago

I'm not seeing anything on that fiddle.

I can reproduce on my system running (I get a false)

POSTGIS="3.4.1 3.4.1" [EXTENSION] PGSQL="150" GEOS="3.12.1-CAPI-1.18.1" PROJ="8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=C:\Users\paragon\AppData\Local/proj DATABASE_PATH=C:\Program Files\PostgreSQL\15\share\contrib\postgis-3.4\proj\proj.db" LIBXML="2.9.14" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" (core procs from "3.3.2 3.3.2" need upgrade)

But on my dev systems I get true.

Both my dev windows system running

POSTGIS="3.5.0dev 3.4.0rc1-1002-g10e23c724" [EXTENSION] PGSQL="160" GEOS="3.12.2dev-CAPI-1.18.2" (compiled against GEOS 3.13.0) PROJ="8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=C:\Users\lr\AppData\Local/proj DATABASE_PATH=C:\ming64gcc81\projects\proj\rel-proj-8.2.1w64gcc81/share/proj/proj.db" LIBXML="2.9.14" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" (core procs from "3.5.0dev 3.4.0rc1-1009-g4b1f87175" need upgrade)

and a linux dev system running:

POSTGIS="3.5.0dev 3.4.0rc1-972-ga832b8598" [EXTENSION] PGSQL="160" GEOS="3.13.0dev-CAPI-1.18.0" PROJ="9.3.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db" GDAL="GDAL 3.8.1, released 2023/11/28" LIBXML="2.9.14" LIBJSON="0.17" LIBPROTOBUF="1.4.1" WAGYU="0.5.0 (Internal)" (core procs from "3.5.0dev 3.4.0rc1-1013-g1284f168d" need upgrade) RASTER (raster lib from "3.5.0dev 3.4.0rc1-1013-g1284f168d" need upgrade) (raster procs from "3.5.0dev 3.4.0rc1-1013-g1284f168d" need upgrade)

So I'm guessing this issue was probably fixed recently. Your 3.2.3 is not latest stable for 3.2, Latest 3.2 is 3.2.7

Going to close this out as soon as I find the patch that fixed it.

comment:5 by pramsey, 6 months ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.