4

Using these instructions (there are several other examples to find, all look the same and all of them seem to work) http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/sp-view.html "Hand-writing your own Spatial VIEW"

I wanted to create a Spatialite View within Qgis. I tried it with DB-Manager and the QspatiaLite Plugin. I get the following error:

views_geometry_columns.read_only may not be NULL

Any suggestions, I don't really know where I could have made a mistake, as it used to be very simple to create a spatialite view.

I used the following code:

CREATE VIEW shape_2015 AS
SELECT komplex_nr_polyg as kompx_nr,
flaeche as flaeche,
polygone as polygone
FROM flaechen

INSERT INTO views_geometry_columns
    (view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
  VALUES ('shape_2015', 'polygone', 'kompx_nr', 'flaechen', 'polygone');
0

1 Answer 1

7

The "read_only" table obviously needs some input, as I could not find anything in the cookbook, after some search I found this insightful discussion with mr. furieri himself:

https://groups.google.com/forum/#!topic/spatialite-users/n8l977RL9-0

conclusion:

1 = TRUE = ReadOnly View (unsupported write ops)

0 = FALSE = Not ReadOnly, thus Writable View 

So the statement should look like this:

INSERT INTO views_geometry_columns
    (view_name, view_geometry, view_rowid, f_table_name, f_geometry_column, read_only)
  VALUES ('shape_2015', 'polygone', 'kompx_nr', 'flaechen', 'polygone', 1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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