Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a a column of data that I'm trying to display in the Categorized Style but when QGIS orders the values it ranks them, for example, 57, 58, 59, 6, 60, 61, 62....

Is there a way to rank them in the correct order?

I'm using a Colour ramp and so the colour for number 6 is as dark as numbers 59 and 60, when it should be much lighter.

enter image description here

share|improve this question

In that case you should use a graduated renderer. It will sort the values correctly.

Categorized renderers are meant for nominal scales.

Graduated renderer will only work with numerical values. So if your column is text, you'll have to convert it to numeric format first. As Andre noted in his comment to another answer, this can be done in field calculator with toint(old_fieldname).

share|improve this answer

Another idea would be to change the column of data to numbers from text (in ArcGIS I add a 'field', remove the shapefile from my work, and then import the .dbf file into open office Calc and turn the text into numbers in the new column then reopen the shapefile with the new improved column of data). Your color ramp will be correct if the software recognizes the numbers (instead of text). Things that look like numbers to me but text to my computer annoy me every day.

share|improve this answer
I think this is the solution. In QGIS, you can add another field in attribute table with field calculator and use toint("<old_fieldname>" ) function to populate the column. You can check if the field is text or number in the fields section of the layers properties. – AndreJ Jan 30 '13 at 20:06

I would create an additional text column formatted like ...,06,07,08,09,10,11,... This should be ordered correctly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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