Is there any chance to calculate line lengths by category. To be precise, I have 4 road categories (state, county, local and uncategorized) and want to calculate them all within one poligone.

So far, I could calculate the lengths for all of them together, using Vector>Analysis tools>Basic statistics, in QGIS 2.10.1-Pisa. It provides me with some statistical information, like standard deviation, what I do not need.

Do I have to make 4 shape files for calculate one category of the road, or is there an add-on or a formula to calculate it?

2 Answers 2


I would probably do the following:

  1. Vector > Data Management Tools > Split Vector Layer

    This splits up your shapefile to 4 separate shapefiles each with a unique category when you select the Unique ID field

  2. Vector > Analysis Tools > Sum Line Lengths

    Then run this tool for each of the 4 shapefiles and your polygon shapefile to get the sum for each category.


Use the GroupStats plugin, which works like an Excel pivot table and allows you to calculate statistics, such as for length in your case, for various combinations of groups.

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.