<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>Smith,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>Actually I wrote that function and have to update it
since its flawed when dealing with non-point things and was also written
pre-existence of st_dwithin.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>The difference is that pgis_fn_nn() is designed for
returning multiple near neighbors per record so comes in handy when you have a
bulk of records</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>e.g. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>for each street find the 5 closes
houses</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>so if you had a set of 10 records of streets you could
get up to 50 records returned back.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>If you only need the closest record per record - using
st_dwithin in conjunction with distinct on is actually much faster - take
a look at this example - the one involving DISTINCT ON</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008><A
href="http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor">http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor</A></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>Hope that helps,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=151503911-16102008>Regina</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Smith
Roman<BR><B>Sent:</B> Thursday, October 16, 2008 5:19 AM<BR><B>To:</B> Users
Postgis<BR><B>Subject:</B> [postgis-users] comparison of nearest neighbour
solutions (st_dwithin() vs pgis_fn_nn() ) ?<BR></FONT><BR></DIV>
<DIV></DIV>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>Thanks for the links to the postgis wiki on nearest neighbour. I
have postgis 1.3.3 so the use of the st_dwithin() function will
work fine for me because its very simple to use. But i have one more
question.</DIV>
<DIV> </DIV>
<DIV> Whats the difference between the use of the
st_dwithin() function and the pgis_fn_nn() function ? I obtained
pgis_fn_nn() from the boston GIS site -<A
href="http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor_generic">http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor_generic</A> </DIV>
<DIV> </DIV>
<DIV>Is one more accurate than the other ?</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Smith.</DIV></TD></TR></TBODY></TABLE><BR></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>
<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>