Thursday, 27 August 2015

qgis - Use field calculator to change values from a,b,c etc. to 1,2,3 etc.?


I have a vector shapefile with a column with string values. How can I convert this to a column of integer values in another column but keep the categorization.


e.g. from:


col1,newcol2
A,
A,
B,
A,
C,



to:


col1,newcol2
A,1
A,1
B,2
A,1
C,3


I'm sure it is in the 'replace' or 'case when' syntax somewhere but I cannot find a clear method via Google etc.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...