2

When I joined a csv file with the attribute table of my vector label everything's cool. Now, when I open the attribute table of the vector layer I can see that I successfully added the new designated column say: data

But when I want to add a graduated style to that new data column in my vector layer I can't find it in the column drop down menu.

I don't understand, what am I doing wrong?

  • Which kind of data type is data column? – aldo_tapia Aug 24 '17 at 11:39
  • Just found out that it's a string type, so yeah now it seems obvious that it doesn't recognise the column there. But when I create a csvt file with the same name and try to convert that column to "Integer", I get only zero's. The data ranges from -1.13 to 0.22. – Tdebeus Aug 24 '17 at 11:48
  • Integer will not work in your kind of data. You need to use real/float/double. @HDunn answered how to convert the field to real. Try it – aldo_tapia Aug 24 '17 at 11:54
2

Graduated symbols can by applied to numeric (integers/real/float/double) fields only. Open the properties of the layer and take a look at the field tab. If data is listed as string, you convert it to a decimal by calculating a new field with

to_real("data")

Define the field as Decimal number and make sure it's long enough, and the precision is 2 (at least) to fit your decimal values.

  • Thanks! Converting the type of variable like this seems better than creating those 'magic' csvt's. – Tdebeus Aug 24 '17 at 12:01
  • It still doesn't work. When I convert the numbers in a new column every value returns a zero... – Tdebeus Aug 24 '17 at 13: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.