QGIS Change Attribute Type

From Tuflow
Revision as of 12:02, 15 May 2017 by Mitch3007 (talk | contribs)
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 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 fields tool:
    QGIS Find Refactor.png

  6. Within the 'Modify Table Structure' you can select any of the attributes and modify the data type. Care needs to be taken to ensure that your data isn't truncated if you intend to use the existing data within that attribute. An example is shown below.
    QGIS Find Refactor.png]

  7. Once you've modified the attribute data type you can review it within the Type column as per the below. If happy with your modifications hit ok.
    QGIS Refactor.JPG]


  8. Once you've modified the attribute data type you can review it within the Type column as per the below. If happy with your modifications hit ok.
    QGIS Field Post Refactor.JPG]


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