12

When is the option to delete field in an attribute table enabled in QGIS? I'm in editing mode and still am not able to delete a field...

  • So you only want to show a single column in the attribute table? or just search on that column only? – Nathan W Aug 19 '13 at 9:45
  • 2
    want only to show a single coloumn in attribute table – Arun Aug 19 '13 at 9:50
  • sql select rows not columns(field) – neogeomat Aug 19 '13 at 12:32
  • @amritkarma can u elaborate please i am totally confused ........ – Arun Aug 19 '13 at 12:45
  • Pleases tell us where you are confused, otherwise we will have difficulty in helping you. Could you explain what do you mean by zoom in the question. – neogeomat Aug 19 '13 at 13:19
6

That button is only avaliable for a PostGIS layer. You can delete table columns via the "table manager" plugin.

  • 6
    Isn't it a bit annoying to have to install a plugin in order to delete fields? thanks – vascobnunes Jul 18 '11 at 13:02
  • 1
    That is true, but this is more of a limitation of OGR driver which QGIS use for read/write vector data. See this bug report: trac.osgeo.org/qgis/ticket/1934 . Fortunatley a fix is in the pipeline: trac.osgeo.org/gdal/ticket/2671 :) – maning Jul 19 '11 at 11:35
  • You can also always open the *.dbf file directly in, for example, OpenOffice Calc and change, add, or delete columns of data. Just make sure all rows are in the same order as in the beginning when you save (e.g. by using a FID field). – SAnderka Jul 25 '11 at 12:49
10

Recent versions of QGIS support deleting Shapefile fields from the attribute table.

Enable editing and then you can edit the shapefile attribute table and multi-delete the columns you do not need.

enter image description here

5

In QGIS 3.0 there is also a button to delete attributes in the properties menu. First toggle editing (right click on a layer -> toggle editing) and go to the properties menu (right click -> properties or just double click). Go to the source fields tab, select the attributes you want to delete and click the button on top.Delete field

1

The "Table Manager" plugin is obsolete. It comes with a warning that it is discontinued and suggests that you use the Refactor Fields processing algorithm instead. This can work. However, another method is to save the layer with a new name, deselect the fields you wish to export, and then delete the previous version that has the fields you wanted removed after the new layer is created.Save As Screen Shot highlighting where to Deselect Fields

0

After looking around many files I found that some field definitions -- especially fields defined through an expression such as "$length" -- appear to be stored only in the *.qgs file, which (at least for QGIS 2.18.13) is an XML file, which means it is a text file that can be edited using simple text editors. The name of the QGIS layer is stored in the <layername>...</layername> element. Look for the layer of interest. The expression fields are listed in the <expressionfields>...</expressionfields> element. For example

<expressionfields>
  <field typeName="FLOAT" precision="0" expression="$length/1000" length="0" type="6" comment="" name="km"/>
</expressionfields>

for a field named "km" whose value is calculated as $length/1000. Delete the <field>...</field> element that you don't want anymore (when the *.qgs file is not in use). Be sure to make a copy of the *.qgs file first, in case things go wrong.

-1

You should look into RT SQL Layer plugin or Fast SQL plugin for QGIS.

A SQL console in QGIS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.