1

I am searching for a workaround to build mean coordinates in graphical modeler since I have noticed a bug which I have reported here: https://github.com/qgis/QGIS/issues/35385

Basically, I just need to find the centroid for groups of points which shall be grouped by a field (like name). Unfortunately the algorithm does not work as intended in graphical modeler, so I have to do it another way. (Building the centroids outside the modeler and using these as input is the worst case workaround and should be avoided if possible).

I was thinking about building a convex hull and getting their centroids, but unfortunately this algorithm does not allow to build groups.

So I thought about Minimum Bounding Gemometry algorithm. I can build grouped convex hulls using this, but it throws back an error, if there are less than 3 points within a group.

I was also trying Geometry by expression and using something like centroid(collect($geometry,group_by:="name")) but with no luck.

Do you have any other ideas how to overcome this issue? It needs to work in QGIS 3.4 graphical modeler with points as input and also if there is only 1 point within a group. It does not have to be a mathematically perfect centroid, but should be within a range of, lets say, 10m of it.

  • Hi, could you dissolve your layer on group name, then use field calculator centroid on the new layer? I tested it with only two points in a group and it worked ok – ian Mar 26 at 17:43
  • No problem, will do – ian Mar 26 at 19:35
1

Try, dissolving on your grouped field, then using centroids on the dissolved layer

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.