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

Within function doesn't consider POINT A is within the GEOMETRYCOLLECTION which contains A. #14

Open
cuteDen-ECNU opened this issue Oct 30, 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 Oct 30, 2023

Consider the following statement:

SELECT ST_Within(a1, a2), ST_Within(a1, a3)
FROM ST_GeomFromText('POINT(0 0)') As a1
, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 0))') As a2
, ST_GeomFromText('GEOMETRYCOLLECTION(LINESTRING(0 0, 1 0), POINT(0 0))') As a3;
--expected{t, t}, actual{f, t}

According to the definition of ST_Within and interior of POINT, geometry a1 is within a2

ST_Within(A, B) ⇔ (A ⋂ B = A) ∧ (Int(A) ⋂ Int(B) ≠ ∅)
For POINTs, the interior is the point itself.

If the POINT(0 0) is behind LINESTRING(0 0, 1 0) (such as a3), Postgis gives the correct answer for ST_Within(a1, a3).
When the POINT(0 0) is in front of LINESTRING(0 0, 1 0) that is shown in a2, Postgis doesn't consider the 'Within' relationship.

ST_With(a1,a2) and ST_Within (a1, a2) give different results while the only difference between a2 and a3 is the order of the linestring and the point. It makes me believe it is a functional issue.

The version is the lastest:
POSTGIS="3.5.0dev 3.4.0rc1-705-g5c3ec8392" [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

cuteDen-ECNU commented Nov 1, 2023

bugtracker link: libgeos/geos#982

@cuteDen-ECNU cuteDen-ECNU added bug-confirm sytax trans Add point to the boundary of geometry libgeos and removed reported labels Nov 3, 2023
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

2 participants