1

I have the problem like you see below: enter image description here

I need just one point. Is there any way of generating the layer, which could contain only one point?

A similar solution I found is here:

Group nearby points and find center point for each group

But I am interested some built-in QGIS algorithm instead

Geographos
  • 4,087
  • 2
  • 27
  • 88
  • 1
    You could add a common ID, e.g. via DB SCAN, then dissolve using that ID, then create the centroids of your multi-point-features. Would this be viable? If not, why so? – Erik May 16 '23 at 15:06
  • DB scan I tried, but it returns everything the same. – Geographos May 16 '23 at 15:16
  • Have you experiemented with the settings? – Erik May 16 '23 at 15:18
  • just a bit, I don't know how many meters should I put – Geographos May 16 '23 at 15:21
  • You don't indicate if you want any particular attributes or statistics of the input points, or how well clustered they are. This thread might help some. https://gis.stackexchange.com/questions/77043/merge-point-features-within-a-given-radius – John May 16 '23 at 15:44
  • Just so many m that all features you want to have the same ID have the same ID. – Erik May 16 '23 at 17:33

2 Answers2

5
  1. Buffer the points with the box Dissolve result checked and a buffer distance slightly longer to cover the nearest point in the cluster.
  2. Run Multipart to single parts
  3. Get the centroid of the dissolved buffer polygon.

Blue: initial points; red dotted line: buffer; red point: centroid/one point per cluster enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
3

[EDIT] I need to revise my original answer because, under specific circumstances, 'DBSCAN clustering' does not solve this problem. E.g., if all the points are within the maximum distance of at least one of the other points, the result will be a single cluster.

To try to illustrate this, imagine that you have post lamps every 100m along a 10km road. If you use DBSCAN clustering with a distance of, e.g., 105m, you will end up with one single cluster, because the distance is applied individually between each pair of points. As long as the next point is less than 105m from the previous one, it will be included in the cluster, even if the most distant points are further away from each other.

As far as I could find, the best option for this task would be to try the tool 'Nearest Neighbours Clusters Map', from the Visualist Plugin.

[ORIGINAL ANSWER] I'm not sure if this is still useful, but I was having a similar issue, trying to group points based on proximity in a waste management project, defining one single (average) point for each group.

I managed to solve it in 2 steps, using 2 tools in the Processing toolbox.

Step 1. As suggested by Erik, I used 'DBSCAN clustering' to define clusters of points based on proximity. In my case, I set 'Minimum cluster size' to 1, and 'Maximum distance between clustered points' to 10m. By default, the tool creates two new fields: CLUSTER_ID (unique ID per cluster), and CLUSTER_SIZE (number of points per cluster). The output is a shapefile with the same number of points as the original file, with a cluster ID associated with each point.

Step 2. Used 'Mean coordinate(s)' to compute a new point layer with the centroid of each cluster defined in step 1. Leave the 'Weight field' option blank, and select the CLUSTER_ID field as the 'Unique ID field'.

Luis Pinto
  • 91
  • 6