I am trying to wrap my head around spatialite views in QGIS. However there are severe limitations that make it very cumbersome:

  1. Spatialite views in QGIS do no update, if the corresponding tables in the DB change Edit: they do in fact update after restart, views behave differently (see comments)
  2. It is not possible to create virtual fields for spatialite views
  3. Attribute types that are defined as INTEGER revert to STRING in the View layer

I often have independent layers (points, polygons) that are connected by a foreign key. The spatialite views join and filter these together.

How are you addressing these issues?

  • Cannot confirm 1) but have a similar issue with 3) – Bushroot Jan 29 '18 at 21:36

I've just started with spatialite and came across your post. Limitation Nr. 1 I can't confirm. If I delete objects from an underlying table, the QGIS-Layer referencing the view reflects those changes correctly (no joins tested though).

However, if I

  1. drop a view and

  2. recreate it under the same name but with different content (fields),

QGIS somehow is not adapting to this new situation. I am not able to import the new view with the new content into QGIS as a layer (in the db-manager everything looks fine).

Even if I delete the view from the views_geometry_columns-table and re-insert it there - QGIS doesn't recognize the new view.

My only workaround so far ist to create a new view instead and give it a slightly different name each time (testview2, testview3, testview4...).

Any help on this topic is highly appreciated..

  • 1
    I had good results with the command "update layer statistics". That usually resolved a lot of issues. I have to adjust my previous statement: yes, layers do update, but only after restarting QGIS. Also, there is a db design limitation that prohibits spatialite from dropping columns. Which makes it very cumbersome in the development phase of a project... Late column changes are very hard to implement (only by recreating the whole table and repopulating). – Lars Aug 21 '15 at 22:53

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.