[postgis-tickets] [PostGIS] #4992: Problem with ST_FrechetDistance in PostGIS/GEOS ?

PostGIS trac at osgeo.org
Wed Sep 15 05:14:26 PDT 2021


#4992: Problem with ST_FrechetDistance in PostGIS/GEOS ?
----------------------+---------------------------
 Reporter:  ezimanyi  |      Owner:  pramsey
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 3.1.5
Component:  postgis   |    Version:  2.5.x
 Keywords:            |
----------------------+---------------------------
 We started the implementation of the discrete Frechet distance in
 MobilityDB and found out that we obtain a different result than
 PostGIS/GEOS.


 {{{
 test=# select frechetDistance(tgeompoint '[Point(1 1)@2000-01-01, Point(2
 2)@2000-01-02, Point(3 1)@2000-01-03]',
 tgeompoint '[Point(1 4)@2000-01-01, Point(2 3)@2000-01-02, Point(3
 4)@2000-01-03, Point(4 3)@2000-01-04]');
  frechetdistance
 -----------------
                3
 (1 row)

 test=# select ST_FrechetDistance(geometry 'Linestring(1 1,2 2,3 1)',
 test(#   geometry 'Linestring(1 4,2 3,3 4,4 3)');
  st_frechetdistance
 --------------------
    2.23606797749979
 (1 row)

 }}}

 We used the simple algorithm referenced in the PostGIS manual
 https://postgis.net/docs/ST_FrechetDistance.html
 and according to our understanding the correct result is 3.

 Intuitively, thinking of the Frechet distance as a man walking a dog on a
 leash, if the distance between the first two points is 3, the result
 cannot be less than 3.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4992>
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