I have a point layer.

Point layer soil receivers

Each feature represents a case where a soil receiving facility has received a weighed amount of soil, this amount is for each feature written in the attribute "Faktisk mængde". Geographically the points overlap since there is a limited number of soil receiving facilities.

Therefore I use the point cluster symbology.

Point cluster.

Automatically the clusters are styled to represent the number of features in the cluster, but i would also like to label the clusters with the sum of the attribute "Faktisk mængde".

Is this possible?

I have tried using the clustering tools to make a new layer as proposed, in this question, but using that tool or DBSCAN does not seem to work even though the features are perfectly overlapping.

1 Answer 1


Open your symbology menu and click on your cluster symbol:

enter image description here

Now click on 'Font Marker' and scroll down to 'Character(s)':

enter image description here

Edit the data defined override and insert this expression, if your points perfectly overlap (if they dont see below):

 aggregate( @layer_name,'sum',"value",filter:=intersects($geometry,geometry(@parent)))

Change "value" to the name of the field you want the sum of. The result:

enter image description here

If they do not perfectly overlap, you need to use a buffer or similar. Like aggregate( @layer_name,'sum',"value",filter:=intersects(buffer($geometry,200),geometry(@parent))). Note that the buffer size (here 200) is in CRS units of your layer.

As buffer function use map unit for calculation, you need to use map unit in cluster distance value. Doing that, your clusters stay the same independently of the map scale. So, if you want clusters that's adapt to map_scale. Supposing your map unit is meter, set your cluster distance value unit at millimeters and change the expression like this: aggregate( @layer_name,'sum',"value",filter:=intersects(buffer($geometry,"cluster_distance"/1000*@map_scale),geometry(@parent)))

Unfortunately just using sum("value",@cluster_size) does not work and just returns the overall sum of all features. Was hoping this could avoid using a buffer and therefore would always be the same as the actual cluster size. But nope.

Of course you could also use these expressions for simple lables instead of displaying it at the cluster sizes space.


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.