<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Dear Regina<div><br></div><div>We started the implementation of the discrete Frechet distance in MobilityDB and found out that we obtain a different result than PostGIS/GEOS.</div><div><br></div><div><div>test=# select frechetDistance(tgeompoint '[Point(1 1)@2000-01-01, Point(2 2)@2000-01-02, Point(3 1)@2000-01-03]',<br>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]');<br> frechetdistance<br>-----------------<br>               3<br>(1 row)<br><br>test=# select ST_FrechetDistance(geometry 'Linestring(1 1,2 2,3 1)',<br>test(#   geometry 'Linestring(1 4,2 3,3 4,4 3)');<br> st_frechetdistance<br>--------------------<br>   2.23606797749979<br>(1 row)</div><div><br></div></div><div>We used the simple algorithm referenced in the PostGIS manual</div><div><a href="https://postgis.net/docs/ST_FrechetDistance.html" target="_blank">https://postgis.net/docs/ST_FrechetDistance.html</a><br></div><div>and according to our understanding the correct result is 3.</div><div><br></div><div>Indeed the matrix of Euclidean distances between a vertex of the first linestring and a vertex of the second linestring is as follows</div><div><br></div><div>3.6 2.23 2.23<br>3.6 2.23 3<br>2.23 1 2.23<br>3 2.23 3.6 <br><br>And the matrix of the computation of the Frechet distance (ca in the algorithm) is as follows<br><br>3.6 3 3<br>3.6 3 3<br>3 3 3<br>3 3 3.6<br><br>Could you please have a look ? If you confirm that there is a problem I will post a ticket in PostGIS and/or GEOS mailing lists.<br></div><div><br></div><div>Many thanks</div><div><br></div><div>Esteban</div><div><br></div></div>
</div></div>