Sometimes, we might need to convert a column or field into something. In this example, I will show you how to convert a numeric column into a text column (string) in QGIS. This task will automatically convert all the rows in a column into a string format. Once we have a string or text column, we can do some string operations to the converted data.
Example:
In the above table, we have a point layer with one numeric column called “elev” which is the elevation of the points. Now we are going to convert those numbers into text and then add “m” to the end of each elevation.
Open QGIS Field Calculator
To convert a number or numeric to a string, we use to_string in the expression window. See the following code to convert the “ele” column and then add ‘m’ to the end of the string.
to_string( "ele" ) + ' m'
The final result will look like this
As you can see, there is a new virtual column called test that contains converted data.
That’s it. I hope this is useful for you who want to learn QGIS.