QGIS Change Attribute Type
This page shows you how to change an attribute data type in QGIS via Table Refactor Field Tool.
For this example we are going to convert data type of the pBlockage field of a culverts 1d_nwk layer from 'double' to 'string' as needed for the AR&R blockage scenarios.
- Firstly, Open your Shape in QGIS.
- Review the current field and data types in your table by right clicking on the layer in your layers panel and selecting Properties.
- Now click on the fields panel on the left hand side of the Layer Properties window. As you can see, the default pBlockage data type generated by TUFLOW is type 'double'.
- To change the datatype we are going to use the refactor field tool, located within the QGIS processing toolbox. To find the toolbox click on the 'Processing' dropdown menu and select toolbox as shown below:
- Now that you have the Processing Toolbox open, search for the refactor field tool:
- In the refactor field dialogue (Example below), select the field you wish to change, in our case the pBlockage field. Change the Type to 'String' and the length to '8'. Set your save location and click run.
- Once you've modified the attribute data type you can review it within the field properties tab (as per Steps 2 and 3 above.
For more handy QGIS workflows, head back to the QGIS Tips and Tricks page.