[postgis-tickets] [PostGIS] #5563: Potential bug in the ST_Equals function.
PostGIS
trac at osgeo.org
Mon Oct 2 07:14:46 PDT 2023
#5563: Potential bug in the ST_Equals function.
---------------------+---------------------------
Reporter: Wenjing | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.4.1
Component: postgis | Version: 3.4.x
Keywords: |
---------------------+---------------------------
Consider the following test case:
{{{
SELECT ST_Equals(Foo.a, Foo.b), ST_Distance(Foo.a, Foo.c)
FROM (SELECT ST_GeomFromText('LINESTRING(2 0, 0 1)') As a,
ST_GeomFromText('LINESTRING(2 0, 0.2 0.9, 0 1)') As b,
ST_GeomFromText('POINT( 0.2 0.9)') As c) As Foo; -- expected: {t},
actual: {f}
}}}
The distance from point c ('POINT( 0.2 0.9)') to line a ('LINESTRING(2 0,
0 1)') is 0. Line b ('LINESTRING(2 0, 0.2 0.9, 0 1)') is plus.
Line a should equal line b because they have the same points set. { (x,y)
| 2*x + y = 0 }
**Actual behavior**: PostGIS doesn’t consider LINE a to be equal to LINE
b. The result of st_equals is false which means Postgis doesn’t consider
they are the same line, although the distance between them calculated is
0.
The issue cannot be reproduced with integers only, indicating a potential
floating-point issue. After all coordinate points are magnified ten times,
the results are in line with expectations.
Additional Information[https://tarry-goal-613.notion.site/Potential-bug-
in-the-ST_Equals-function-398b8876ee9842219cb872e7eb7bb546?pvs=4]
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5563>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list