3

I have shapefile data set (Road segments) my area of interest is to calculate the length of all road segments having a particular attribute, e.g.: sum of (length attribute) when Attribute1=something. How to do this in QGIS using python, graphical model or any suitable method?

1
  • 3
    Have you read the documentation on the sum() expression? If so, what is left unclear?
    – Erik
    Commented Mar 23, 2022 at 11:22

1 Answer 1

5

Here is one suggestion. Functions are available from processing toolbox.

  1. Run Add Geometry attributes which will add a field length to a new in- memory layer.
  2. Run Statistics by Category on the in-memory layer with field length selected for stats and your category attribute chosen: enter image description here The output of this will be a table:

enter image description here

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