<div dir="ltr">Hi<div><br></div><div>The test</div><div>select st_hausdorffdistance(st_geometryfromtext('LineString(0 0, 1 0)'), st_geometryfromtext('LineString(0 5, 1 5)'))</div><div>gives a distance of 5, not 0 as one would expect if HD only measured shape similarity, so I think it still can be used for your task. Something like hibernate spatial should provide programmatic interfaces for common gis functions, but I suspect you have to write native sql if you want to use postgis-specific functions like hausdorffdistance.</div>
<div><br></div><div>Åsmund</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 9:36 AM, Rémi Cura <span dir="ltr"><<a href="mailto:remi.cura@gmail.com" target="_blank">remi.cura@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hey,<br></div>I'm not so sure Hausdorff distance is what you want.<br></div>It measure how similar 2 shapes are, yet you could have two very similar parts of a road network that are very far away.<br>

</div>In you case you are trying to express both lines that are close to each other __and__ that are similar in shape.<br><br></div>Of course the obvious (but painfull) way to go would be to use postgis topology with the tolerance set to your GPS error (+ width of the road). This way close path would be merged automatically.<br>

<br><div><div>Cheers,<br>Rémi-C<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-13 23:56 GMT+02:00 Raghavan Krishnasamylakshmanaperumal <span dir="ltr"><<a href="mailto:rkrish20@uic.edu" target="_blank">rkrish20@uic.edu</a>></span>:<div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi <span style="font-family:arial,sans-serif;font-size:13px">Åsmund,</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br>

</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Thanks for suggesting </span><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">ST_HausdorffDistance, </span><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">I tried this function directly on the database using sql query and</span><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px"> it looks like solving my problem.</span></div>



<div><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px"> </span></div><div>Are these functions <span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">ST_HausdorffDistance/</span><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">ST_Distance available as java APIs? I am trying to use org.postgis(postgis-jdbc-1.3.1.jar) library but not sure how to access the above mentioned functions using java. Please suggest me which package to look into to make use of these functions programmatically?</span></div>



<div><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">Thanks in advance.</span><span><font color="#888888"><br>



</font></span></div><span><font color="#888888"><div><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(46,46,46);font-family:'Lucida Grande',Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:13px">-Raghavan</span></div>



</font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 13, 2014 at 1:45 PM, Åsmund Tokheim <span dir="ltr"><<a href="mailto:asmundto@gmail.com" target="_blank">asmundto@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>I think you should be able to use hausdorff distance <a href="http://postgis.net/docs/ST_HausdorffDistance.html" target="_blank">http://postgis.net/docs/ST_HausdorffDistance.html</a> to recognize that the green, red and blue lines in your image are all similar. This method will fail to recognize shared portions of a path (e.g. if the blue line at some point diverges from the red and green line), but I'm not sure if this is a requirement for your task</div>




<div><br></div><div>Åsmund</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sat, Apr 12, 2014 at 9:41 PM, Raghavan Krishnasamylakshmanaperumal <span dir="ltr"><<a href="mailto:rkrish20@uic.edu" target="_blank">rkrish20@uic.edu</a>></span> wrote:<br>




</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi,<div><br></div><div>I have formed a graph using my GPS traces of running/biking activities in which I have many edges representing the same path. For example every time I run from node-A to node-B my GPS traces are noted close to each other like the red,green,blue lines in the attached image. Actually those 3 lines are same(representing the same path), so I want to detect such linestrings automatically and keep only one linestring and ignore others. Is there any way in PostGIS which can help me to detect the nearness/closeness of the linestrings?<span><font color="#888888"><br clear="all">






<div><br></div>-- <br>Thanks and Regards,<div>Raghavan KL</div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks and Regards,<div>



Raghavan KL</div>
</div>
</div></div><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>