1

I have a problem following the QGIS training manual lesson 3.3 (Ratio Classification).

You have to add a column to an SQlite layer. The new column is AREA. I followed the instructions and added it as shown, then saved it, and received the following error message (in orange on the screen)

Commit errors: Could not commit changes to layer land use

Is the manual wrong, or am I doing something wrong?
Can anyone else duplicate what the manual asks?

1

I too get the same error for this exercise. If you click on the error message banner it will give you more details of the error. For me this gives...

Errors: ERROR: 1 new attribute(s) not added  
  Provider errors:
      SQLite error: duplicate column name: AREA
    SQL: ALTER TABLE "landuse" ADD COLUMN "AREA" FLOAT

It appears that the supplied "landuse.sqlite" file in the exercise data is in a confused state: if a connection is made to the sqlite database within QGIS(2.6), then the database is examined via menu Database -> DB Manager -> DB Manager then selecting "landuse" within the database, it can be seen that a field called ACCESS already exists. However, if this layer is loaded into QGIS via the "Add Spatialite Table" button, an examination of layer properties->fields or just opening the attribute table will not show the field.

(Starting with a new copy of landuse.sqlite), if a different column name is added "AreaV2", then the hidden "AREA" field suddenly becomes visible and a different error is generated...

Errors: SUCCESS: 1 attribute(s) added.
  ERROR: the count of fields is incorrect after addition/removal of fields!

Note: this is using data taken from the official download location... http://qgis.org/downloads/data/training_manual_exercise_data.zip Perhaps when the database was created the "AREA" field was deleted after testing, but the deletion method only partially worked?

0

Adding new columns to SpatiaLite databases works. (Just tested adding a column named AREA of type double in 2.4.) If there is a problem, I would assume that it is that you don't have write access to the database.

0

I also had the "duplicate column" error. The problem was that the landuse data base needed to be upgraded from version 3 to 4 using the command

spatialite_convert -v 4 -d land_use.db

This requires the spatialite-tools package to be installed.

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.