I have a layer called "streets". It has an attribute called "traveled". The values are either "yes" or "no". If the value is "no", I would like to display those streets in a different color (than the ones with "yes" as the value).

Also this "streets" layer has an attribute called "miles". If the "traveled" attribute is "yes", I would like to retrieve the total "miles" from the "traveled" streets only.

  • Hi Rick, welcome to GIS.SE. Please make sure in the future, that you do not ask multiple questions in a single post. Otherwise answering and finding the right answer for others is unnecessarily complicated.
    – Erik
    Nov 6, 2018 at 11:41

1 Answer 1

  1. Go to the properties of your layer, choose the style tab and there classified based on the column "travelled".
  2. First, use the field calculator to add the column "dist" to your table, set it as an integer type and use the code $length to fill it. Then, use sum("dist",group_by:="travelled") to get the aggregated values.

Maybe you have to edit the second part a bit, please refer to the tooltips within the raster calculator.

  • 1
    The raster calculator doesn't seem relevant here. Did you mean field calculator?
    – csk
    Nov 6, 2018 at 20:24
  • Obviously, yes.
    – Erik
    Nov 7, 2018 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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