[Qgis-user] Opening Spatialite view in QGIS gives me Error in atribute table
richard burcher
drownedfrog at gmail.com
Sat Sep 1 07:39:43 PDT 2012
Hi Alexandre,
Please refer to the Spatialite Cookbook [0], it provides a walk through.
To create a view do the following:
# overview of my table to become view from "pragma table_info(analysisMspa)
cid name type notnull dflt_value pk
0 pkuid integer 0 None 1
1 geometry MULTIPOLYGON 0 None 0
2 mspaClass integer 0 None 0
# create view -- must have "ROWID" to work correctly. i am casting pkuid (pk
in table) as "ROWID"
create view viewTest as select c.pkuid as ROWID,c.geometry as
geometry,c.mspaClass as mspaClass from analysisMspa as c;
# must register this. refer to [1], sandro gives a good explanation. f_*
columns ref orginial table
insert into views_geometry_columns
(view_name,view_geometry,view_rowid,f_table_name,f_geometry_column) values
('viewTest','geometry','ROWID','analysisMspa','geometry');
# check if registered correctly
select * from views_geometry_columns;
## my output for reference
#view_name view_geometry view_rowid f_table_name f_geometry_column
#viewTest geometry ROWID analysisMspa geometry
# must add view from "add spatialite layer" from qgis menu
connect to db & select view, click add
[0]
http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-cookbook/html/sp-view.html
[1]
https://groups.google.com/forum/?fromgroups=#!searchin/spatialite-users/qgis$20views/spatialite-users/1LPOk4ivl1E/MxTGl4IqgIcJ
Cheers,
Richard
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Opening-Spatialite-view-in-QGIS-gives-me-Error-in-atribute-table-tp4998995p4999171.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
More information about the Qgis-user
mailing list