QGIS Change Attribute Type

From Tuflow
Revision as of 14:43, 22 June 2021 by Chris Huxley (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
    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.
  1. Firstly, Open your Shape in QGIS.
  2. Review the current field and data types in your table by right clicking on the layer in your layers panel and selecting Properties.
    QGIS Properties.png

  3. 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'.
    QGIS Field Pre Refactor.JPG

  4. 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:
    QGIS Processing Toolbox.png
  5. Now that you have the Processing Toolbox open, search for the refactor field tool:
    QGIS Find Refactor.png

  6. 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.
    QGIS Refactor.JPG]


  7. Once you've modified the attribute data type you can review it within the field properties tab (as per Steps 2 and 3 above.
    QGIS Field Post Refactor.JPG]


    For more handy QGIS workflows, head back to the QGIS Tips and Tricks page.



Up
Go-up.png Back to QGIS Tips And Tricks