3

I'm very new to GIS technology and have been trying to learn qGIS through downloaded tutorials. My qGIS is the 2.14.21 version. It was going well until the instructions told me to edit the attribute table of one of my layers (a sqlite layer with a polygon geometry type). The edit button is 'greyed' out, not allowing me to access this function. Why is this? I have tried various ways of selecting the data, restarting the program, and accessing the table through different buttons. The 'add a new field' button is also greyed, though the field calculator is functional. My online research hasn't come up with answers yet. Image below is what I see when I open the attribute table

K.Wright
  • 31
  • 1
  • 1
  • 4
  • Try selecting the layer and toggle edit mode... – Gerardo Jimenez Dec 27 '17 at 20:40
  • How can I toggle edit mode if it is grey and not allowing me to access its function? – K.Wright Dec 29 '17 at 00:51
  • Can you edit the attribute table of other layers? – csk Jan 02 '18 at 19:20
  • Unfortunately no I can't. The same greyed out edit button is there too – K.Wright Jan 03 '18 at 00:30
  • 1
    Your table may lack a primary key to be editable. This usually happens with OSM data put into a pgsql database with osm2pgsql. Not sure how you populated your sqlite layer. Maybe related: https://gis.stackexchange.com/questions/157541/postgresql-trouble-editing-points-lines-polygons-in-qgis – AndreJ Apr 24 '18 at 09:52
  • Just adding to existing answers: Sometimes it is just about restarting the application. – user2821 Nov 26 '20 at 23:39
  • This can also happen when you open a shapefile as a .zip, opening the unzipped version made it editable in my case. – Jason Axelson Jan 20 '23 at 22:36

7 Answers7

9

This can happen if you don't have permission to edit the layer. Outside of QGIS, open the folder that the layer is in, right-click on the layer, and open Properties > Security. Where it says "Permissions for [username]" there should be a check next to "Modify" and "Write." If not, change the permissions for that file. If you don't have permission to change the permissions (a rather infuriating logic loop), save a copy of the layer to a folder that you can edit, and work from the copy.

csk
  • 24,827
  • 3
  • 32
  • 70
2

Try "Toggling editing" from the right click menu in the Layers Panel BEFORE opening the attribute table - it worked for me!

1

In my case, layer was "read-only" in Project-Properties-Data Sources

Martin
  • 11
  • 1
1

You have to save the layer, for instance I add data from a *.csv file and you will work perfect with that data but if you don't save the layer as a shapefile using right click > save object or similar (I have qgis in spanish) you are not going to be able to edit it.

swiss_knight
  • 10,309
  • 9
  • 45
  • 117
TOMAS
  • 11
  • 1
1

I had the same and had to save the imported maplayer first under a different file-name.

Select the greyed-out maplayer in your main map screen. From toprow: Maplayer > save as ... (somewhere in the middle of the menu) write down a filename. Browse to a map with the three dots on the right.

Mark the checkbox "add saved file to the map". press OK. Back in your main map screen, you have both maps. The first is still with the greyed-out attribute table. The new one is editable.

0

I had the same issue when I added the shapefile by Add vector layer - browsed to a zip file and then selected the shapefiles it offered. When I unzipped it, went to Add vector layer and directly selected the shapefile I want to add (as opposed to the zip file), the Toggle Edit option became active.

Emese
  • 1
0

I have come across this issue. The easiest way worked with me is check if you have primary key in your data. If not, add one and reload the feature and try editing. But because shapefile does not have a primary key concept, you can use field calculator to create a column that utilizes row or record number as its value.

Hilal Al-Rajhi
  • 210
  • 1
  • 11