Bug report #10401

Styling layer by category fails to draw if field is of type char(x)

Added by Ross McDonald over 10 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:18817

Description

My PostGIS polygon layer has a field, "prob", with values H, M and L. If I select a categorized style using the "prob" field I get the expected three values plus an extra empty one. However, the layer is drawn using the style of the extra category - in the screenshot the pink lines and not the solid blues as expected.

To fix it I had to change the "prob" field type from char(x) to varchar(x). The probability field was a char field 50 characters wide, i.e 'H and then 49 spaces'. I reloaded the data into PostGIS with the field as varchar(x) and now it works as expected (although I still get the extra empty category added and I can delete it). Storing the data in Postgresql as varchar is preferable as it uses less space.

The rules based renderer worked if I had a rule like: "prob" LIKE 'H%' or TRIM but that doesn't fix the categorised style issue.

categorised_style_issue.jpg (205 KB) Ross McDonald, 2014-05-30 08:42 AM

History

#1 Updated by Giovanni Manghi over 10 years ago

  • OS version deleted (7)
  • Operating System deleted (Windows)

Confirmed down until 1.8 included.

#2 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#3 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF