Bug report #4051
Cannot display SpatiaLite views based on tables with spatial index
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||14037|
If I add a spatial index to the parent table of my view in SpatiaLite, the features are not rendered in QGIS anymore. When I disable the index, it renders again.
Tested on Ubuntu Natty.
#8 Updated by Anita Graser over 7 years ago
To me, it seems like the problem persists. If I create a new Spatialite table with QGIS new layer, it automatically adds indexes. If I then create a view based on this table, the features won't be rendered in the DB Manager preview (it's not enabled) or in the QGIS main window. (I can add the layer but it remains empty).
Querying features using e.g. SELECT astext(geometry) FROM my_view; works fine as expected.
#12 Updated by Stefano Maran about 7 years ago
I am using QGIS 2.4.0. If I use the info tool, I can see the attributes; if I use the DB Manager, I can see the attribute table; but if I use the "open attribute table" button, I see only columns filled with ERROR string and, of course, I cannot use the table tools.
#13 Updated by Médéric RIBREUX almost 6 years ago
- Status changed from Open to Feedback
Hello, bug triage...
I've made some tests with QGIS 2.13. I've used the Spatialite provider to create a new database and a new layer (which also configures a spatial index on it).
I've then used DBManager to create a view on this table based on a select query and "create view" button.
DBManager (Spatialite actually) complains that the view name needs to be lower case. Whenever I set a lower case name for a view, it is correctly inserted into the 'geometry_columns' table/view and the view can be correctly displayed in QGIS canvas and in DBManager preview tab.
So it seems that this bug is fixed, at least in QGIS 2.13 master. QGIS displays all the errors to informs the user about what to do to have a correct spatial view in Spatialite.
Do you still have problems on your side ?