0

I have a map with many duplicate points and I want to combine those points together into one, based on the name and geographical location (10 meters), is there a way to do this with QGIS, given that I tried the following method:

Aggregate > GROUP_BY= geom_to_wkb($geometry)

enter image description here

When doing this, the application merged the duplicate points in the exact same place and did not work within 10 meters

Is there a solution to do this on QGIS?

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • Thank you I forgot about that, I added a screenshot, if there is a better way to group it by Name/Geolocation (10m)/Average distance between duplicate points – Abdullah Abdullrhman Sep 28 '22 at 15:53

1 Answers1

1

I'm not sure if this is best, but I think it will work. I wasn't able to find a plugin or other way to accomplish all your requirements.

  1. DBSCAN enter image description here

  2. Calculate field with a value of Name plus CLUSTER_ID. Expression something like this,

    Concat("Name",'_',to_string("CLUSTER_ID"))

  3. Mean Coordinate(s) with Unique field being your Calculated field.

  4. Join the mean coordinate output with your previous output to get the attributes merged. You can export as well to have a unified layer.

cndnflyr
  • 3,392
  • 2
  • 25
  • 43
  • Thank you very much for this great solution and I added a step which is I filled the nulls values in the CLUSTER_ID column with:

    if("CLUSTER_ID" is null,rand(200000,900000), "CLUSTER_ID")

    This is because names that are very far from each other may match and are calculated in Mean Coordinate(s)

    Regards

    – Abdullah Abdullrhman Sep 29 '22 at 14:29
  • Glad it worked. A wildly random number is a neat solution for the null values. Very quick. For a cleaner solution, have a look at QGIS project variables. You could set and increment a variable similar what's described here, https://gis.stackexchange.com/questions/222494/how-to-read-user-defined-project-variables-using-python – cndnflyr Sep 29 '22 at 15:14
  • Yes, it is not a clean solution, but the nulls I had were few and it was suitable for me, and I did not know a way to do otherwise, I remember in Excel you can put a number and then increment it and it does not repeat. – Abdullah Abdullrhman Sep 30 '22 at 05:05