<html style="direction: ltr;">
<head>
<meta content="text/html; charset=windows-1255"
http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="preferred-charset" text="#660000"
bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 26/08/2013 09:21, Lynkos wrote:<br>
</div>
<blockquote
cite="mid:CAJj0rYg7katzXUWkUHm-6QVUCp5507aownGKQKLduLFk28oycw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,102)"><span
style="font-size:12.727272033691406px">Here I am again with
another of my "all too obvious" queries. I have a points
shapefile (with about 1000 points) and for each point, I
need to calculate the distance between that point and its
nearest neighbour. I have tried to use the SDA4PP plugin
which seems perfect, but can't get Rpy2 working. Is there
another simpler way? Thanks, Sarah. </span><br clear="all">
</div>
<br clear="all">
</div>
</blockquote>
<br>
Here's how to do it in Spatialite: First import your points
shapefile into a Spatialite database. If you do this with
spatialite_gui, there's an option to automatically create a primary
key (recommended) then run a query like:<br>
<br>
SELECT p1.pk_uid, p2.pk_uid, MIN(ST_Distance(p1.geometry,
p2.geometry))<br>
FROM points AS p1, points AS p2 <br>
WHERE p1.pk_uid <> p2.pk_uid<br>
GROUP BY p1.pk_uid;<br>
<br>
If you need the results exported to some table, then a right click
in the gui result window brings up a menu with an option to export .<br>
HTH,<br>
Micha<br>
<br>
<br>
<blockquote
cite="mid:CAJj0rYg7katzXUWkUHm-6QVUCp5507aownGKQKLduLFk28oycw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
-- <br>
<div dir="ltr"><font style="color:rgb(0,51,0)"><span
style="font-family:'comic sans ms',sans-serif"><font
size="4"><b>Sarah Gregg</b></font></span></font><br>
<font style="color:rgb(51,51,255)"><span
style="font-family:'comic sans
ms',sans-serif;color:rgb(0,51,0)">immagini - parole -
territorio - natura </span></font><br>
<div><font color="#003300"><font><span
style="font-family:'comic sans ms',sans-serif">Web</span></font><font><span
style="font-family:'comic sans ms',sans-serif">:</span></font><font><span
style="font-family:'comic sans ms',sans-serif"> </span></font><font><span
style="font-family:'comic sans ms',sans-serif"><a
moz-do-not-send="true"
href="http://www.wild-eyes.eu/" target="_blank">www.wild-eyes.eu</a></span></font></font></div>
</div>
</div>
<br>
This mail was received via Mail-SeCure System.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
GIS Consulting
052-3665918
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a>
</pre>
</body>
</html>