On 26/08/2013 09:21, Lynkos wrote:
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. 


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:

SELECT p1.pk_uid, p2.pk_uid, MIN(ST_Distance(p1.geometry, p2.geometry))
FROM points AS p1, points AS p2
WHERE p1.pk_uid <> p2.pk_uid
GROUP BY p1.pk_uid;

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 .
HTH,
Micha



--
Sarah Gregg
immagini - parole - territorio - natura 

This mail was received via Mail-SeCure System.


_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

This mail was received via Mail-SeCure System.




-- 
Micha Silver
GIS Consulting
052-3665918
http://www.surfaces.co.il
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to