3

I converted a shapefile to a SpatiaLite database so I could work with attributes with a length longer than 254 characters, and also not see some columns and change their order.

In QGIS 2.18.16 I have used DB Manager to connect to this SQLite database, selecting the columns from the table I want to bring into my project, and in the order I want to work with the columns.

I am using the following code in the SQL window to do this

    `SELECT  id, cpt, sub_cpt, name, area_hect, category, designat, grid_ref,
     species, plant_year, activity, actvtynote, years, restock, notes, GEOMETRY 
     From "clientname subcompartments SQLITE "

enter image description here

It loads into the project fine, but the layer is not editable? I have the SQLite file on my local hard drive

How to load it as an editable layer?

I am sure it must be something simple that I am not doing, or just basic misunderstanding as I am not familiar with working with SQLite.

I have had a look through GIS Stack Exchange but cannot find anything.

  • you can't make a query result layer editable; there would be no (easy) way to define how edits should affect the base data when the loaded data is e.g. only a subset (compare with PostGIS Views and the needed trigger/rule set to make data manipulation possible). you can, however, simply load the layer from the SpatiaLite file, it'll be editable just fine (just double-click the layer you want, even from within the Browser panel in the main GUI). – ThingumaBob Jan 15 at 20:35
  • ...of course, you cannot filter columns or alter column order this way. if that is of importance, you can, also in SQLite, create and work with a View instead, where an INSTEAD OF trigger is in place that reroutes any data manipulation to the corresponding tables. – ThingumaBob Jan 15 at 21:02

Your Answer

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

Browse other questions tagged or ask your own question.