4

Background:

At 3.14.16, I'm trying to learn a little more about Geometry Generator, in this case convex hull. I created a simple test point layer with six points. I then used Geometry Generator with the expression convex_hull($geometry), expecting an outline hull to display. However, none appeared, as shown in the screenshot below. Only the original points appear.

In my search for a solution, I came across this SE GIS post, where convexHull($geometry) was successfully used. Unfortunately, that expression did not result in a outline for my points.

Question:

How do I display a convex hull around a point layer using Geometry Generator?

enter image description here

2 Answers 2

7

You need to select Polygon/ MultiPolygon geometry type for the geometry generator symbol layer, and add the collect function to your expression:

convex_hull(collect($geometry))

enter image description here

Update August 2023:

the $geometry function is now deprecated in favor of the @geometry variable.

So:

convex_hull(collect(@geometry))
2
  • 1
    FYI, now, $geometry is deprecated. You should switch to @geometry instead
    – etrimaille
    Commented Aug 11, 2023 at 16:49
  • @etrimaille, thanks for the reminder- answer updated.
    – Ben W
    Commented Aug 12, 2023 at 5:09
2

The correct answer is the one accepted.

Just adding another one if you are looking to do it with a common attribute :

convex_hull(collect (@geometry, group_by:="name_of_attribute"))

convex hull with a common attribute

A mix between Geometry generator - classify objects in QGIS and the accepted answer here

Just to share, it took me some time to see we could give a group by in the collect expression.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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