I want to appropriate line segments that share the same geometry with a particular line width and labels based on the aggregated values of one field "GIS@BUS_5_Min".

My attribute table and polyline objects look as following, see image below.


"BUSLINIE" means a bus line, "Overlap" means if the line has overlaps, i.e. it's geometry repeats.

Values of the field "GIS@BUS_5_Min" for these three objects has to be aggregated as one value and represented as a label sum("GIS@BUS_5_Min").

And the width of this line (selected in yellow) will be sum("GIS@BUS_5_Min")/100 = 19.10/100 = 0.1910

How can I achieve such output?

I assume it is possible with Layer Properties > Width > Data defined override > Edit..., but I do not know how to check the same geometry and how to sum the values of certain features with CASE WHEN condition THEN result END conditional function?

The "Dissolve" function does not work in my case because I do not have any key-fields.


  • You could add a field and, for all overlapping segments, choose a parent segment who could become the key to aggregate with. From there you could use the information from this blog post to aggregate with expressions. Could that achieve what you need?
    – Gabriel
    Commented Nov 29, 2018 at 13:45

1 Answer 1


In the Symbology > Stroke Width > Data defined override, please try an expression:

sum("GIS@BUS_5_Min", group_by:=geom_to_wkt($geometry))/100
  • @Kazuhito Does this expression work only if the geometries exactly match? For instance if one segment was longer than another that overlapped it for a short distance.
    – Gabriel
    Commented Nov 29, 2018 at 14:52
  • @GabrielC. Yes, you are right. If there is difference in any part of the geometry, this expression fails to match them.
    – Kazuhito
    Commented Nov 29, 2018 at 14:58

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.