0

I'm quite new to QGIS and I guess my question is quite simple but yet I couldn't find out how to do this successfully

I Have a 'roads' string column with text such as:

primary

secondary

etc.

and I want to make a new column/layer that which I give an integer value such as:

1

2

Respectively

So I can later Rasterize the layer

Any Ideas?

BERA
  • 72,339
  • 13
  • 72
  • 161
tristramit
  • 507
  • 2
  • 12

1 Answers1

3

you can use the CASE statement in the field calculator:

CASE 
  WHEN "roads" = 'primary' THEN 1
  WHEN "roads" = 'secondary' THEN 2
  ...
END
Hicham Zouarhi
  • 3,255
  • 2
  • 19
  • 32