4

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.

Example

"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.


References:

Taras
  • 32,823
  • 4
  • 66
  • 137
  • 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 Nov 29 '18 at 13:45

1 Answers1

7

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

sum("GIS@BUS_5_Min", group_by:=geom_to_wkt($geometry))/100
Taras
  • 32,823
  • 4
  • 66
  • 137
Kazuhito
  • 30,746
  • 5
  • 69
  • 149
  • @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 Nov 29 '18 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 Nov 29 '18 at 14:58