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

Covers function doesn't consider MULTIPOLYGON a1 covers a MULTIPOINT containing 'EMPTY' #21

Open
cuteDen-ECNU opened this issue Nov 8, 2023 · 2 comments
Labels
fixed jts sytax trans Add point to the boundary of geometry

Comments

@cuteDen-ECNU
Copy link
Owner

cuteDen-ECNU commented Nov 8, 2023

Consider the following statement:

SELECT ST_Covers(a1, a2)
FROM ST_GeomFromText('MULTIPOLYGON(((1 0,0 1,-1 0,0 -1, 1 0)))')
As a1, 
ST_GeomFromText('MULTIPOINT(EMPTY,(0 0)) ')
As a2;
-- actual{f}, expected{t}

According to the definition of ST_Cover below and the point of geometry a2 lies inside, geometry a1 covers a2.

Returns true if every point in Geometry/Geography B lies inside

But Postgis doesn't consider the cover relationship which seems a bug.

Version is the latest from GitHub:
POSTGIS="3.5.0dev 3.4.0rc1-749-g42f04a29e" [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" (core procs from "3.5.0dev 3.4.0rc1-748-gaedf3b14f" need upgrade)

@cuteDen-ECNU
Copy link
Owner Author

cuteDen-ECNU commented Nov 9, 2023

bugtracker link: libgeos/geos#988
fix link: locationtech/jts#1015

@cuteDen-ECNU
Copy link
Owner Author

cuteDen-ECNU commented Nov 10, 2023

It could be an optimization issue. In the compile process, there is a file named configure. ST_Cover returns the expected result True if I add --enable-debug option to execute it. However, ST_Cover returns the unexpected result False when I remove --enable-debug :

./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config \
 --with-geosconfig=/usr/local/bin/geos-config \
 --without-protobuf --without-raster 

To give more evidence about this optimization suspect, I have replaced each '-O2' to '-O0' in configure file, ST_Cover returns the expected result.

Meanwhile, I have tried compiling with -fsanitize=address and -fsanitize=undefined. It seems Postgis isn’t compatible with sanitizer:

psql:script/simplify.sql:43: ERROR:  could not load library "/usr/local/pgsql/lib/postgis-3.so": /usr/local/pgsql/lib/postgis-3.so: undefined symbol: __asan_option_detect_stack_use_after_return

So I cannot give a more accurate location.

@cuteDen-ECNU cuteDen-ECNU added PostGIS fixed libgeos sytax trans Add point to the boundary of geometry Empty and removed PostGIS sytax trans Add point to the boundary of geometry labels Nov 23, 2023
@cuteDen-ECNU cuteDen-ECNU added sytax trans Add point to the boundary of geometry and removed Empty labels Dec 19, 2023
@cuteDen-ECNU cuteDen-ECNU added jts and removed libgeos labels Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed jts sytax trans Add point to the boundary of geometry
Projects
None yet
Development

No branches or pull requests

1 participant