New answers tagged nearest-neighbor
A similar question was asked before which aims to find the Nearest neighbor between a point layer and a line layer, with an answer provided by @scw which uses the Shapely Python package. This might help put you in the right direction. Alternatively, there is a Distance to nearest hub tool in QGIS which can create lines between a point source and its closest ...
The query will take quite a while, for sure, w/ 250M points (perhaps too long). I'm assuming here that your points are in a metric coordinate system. Looks like this: SELECT a.gid, count(*) FROM pts a JOIN pts b ON ST_DWithin(a.geom, b.geom, 100) WHERE a.gid != b.gid GROUP BY a.gid;
Top 50 recent answers are included