2

I have a health data set and an "urban stress". I'm trying to do bivariate analysis within QGIS using Joshua Stevens lessons at http://www.joshuastevens.net/cartography/make-a-bivariate-choropleth-map/. As per Joshua's instructions, in QGIS the best way to do this is to write a CASE function to classify values into a preset organizational value. For example:

CASE WHEN  "CrimeRate" > 4.0 THEN 3
    WHEN "CrimeRate" <= 4.0 AND "CrimeRate" > 2.0 THEN 2
    ELSE 1
END

This field calculator function worked perfectly. The next example filled my column with NULL values:

CASE WHEN  "POOR345" > 52.9 THEN 'C'
    WHEN "POOR345" <= 52.9 AND "POOR345" > 40.3 THEN 'B'
    ELSE 'A'
END

Does anyone have an idea of why this is happening?

2

Will you check the Output field type, Text (string) or Whole number (integer) ? You would have set it to integer (3, 2, 1) first . For your second case ('C','B','A'), you need to change it to string type.

Output field type dropdown list:

enter image description here

  • That fixed it immediately. For the life of me, I could not figure it out. Thank you! – Jess Dec 3 '16 at 22:50
  • Welcome! I am glad it worked out for you, but I was sure sooner or later you would have figured it out yourself, since you have precisely pinpointed the problem. Thank you so much for sharing nice and intuitive article by Joshua Stevens, by the way. – Kazuhito Dec 4 '16 at 3:03
  • Jess and Joseph, Thank you! Sorry I did not notice. – Kazuhito Jan 22 '17 at 0:59

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.