3

I have a shapefile with a few thousand shapes, each with a specific value. Using Graduated classifcation, I can classify these shapes into ten categories based on value ranges. I'd like to use these 10 categories for statistical calculations. To do this I need to pull these categories into the Attribute table.

Is there a way a that this can be done, without manually doing the classification with From-To values in the the field calculator?

1 Answer 1

2

At the moment, I don't think there is an easier method other than creating an expression for the Field Calculator and storing the value ranges in a string field. With 10 categories, it would be a fairly long expression where it could look something like:

CASE
WHEN "fieldName" >= 1 AND "fieldName" < 10 THEN '1.0 - 10.0'
WHEN "fieldName" >= 10 AND "fieldName" < 20 THEN '10.0 - 20.0'
WHEN "fieldName" >= 20 AND "fieldName" < 30 THEN '20.0 - 30.0'
...
WHEN "fieldName" >= 90 AND "fieldName" < 100 THEN '90.0 - 100.0'
ELSE '0'
END
3
  • 2
    Thx @joseph. This is exactly what I ended up doing.
    – Chris A
    Commented Jan 8, 2018 at 6:44
  • @ChrisA - Most welcome, hope it was helpful :)
    – Joseph
    Commented Jan 8, 2018 at 10:18
  • I'm working on similar problem. Is there any improvement in QGIS for transferring classification result into attribute field? Commented Sep 1, 2020 at 13:10

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.