Thursday 5 September 2019

labeling - Line width and labels based on blended values of features sharing same geometry in QGIS


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?


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


References:




Answer



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


sum("GIS@BUS_5_Min", group_by:= geom_to_wkt($geometry))/100

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...