2

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

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
  • 1
    Thx @joseph. This is exactly what I ended up doing. – Chris A Jan 8 '18 at 6:44
  • @ChrisA - Most welcome, hope it was helpful :) – Joseph Jan 8 '18 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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