[Qgis-developer] No views visible in QGIS when loading a SpatiaLite layer?

Stefan Keller sfkeller at gmail.com
Mon May 3 06:20:03 EDT 2010


As a problem related to the recent thread about "No 'Type' in a
SpatiaLite View" reported by Simon Keller, I have a related more
fundamental question:

Has anybody ever managed to load and display a SpatiaLite/SQLite layer
into QGIS when the source is a VIEW instead of a TABLE?

Yours
-S.

P.S. Here what I did:

-- Given the following famous Towns table from the SpatiaLite tutorial:
CREATE TABLE Towns (
  PK_UID INTEGER PRIMARY KEY AUTOINCREMENT,
  Name TEXT,
  Peoples INTEGER,
  LocalCounc INTEGER,
  County INTEGER,
  Region INTEGER, "Geometry" POINT
)
SELECT * from towns;

-- Let's create a view... containing at least a PK (of type integer)
and a geometry
-- as well as a calculated column
CREATE VIEW IF NOT EXISTS towns_test_v AS
  SELECT PK_UID, Name, Peoples + 1, Geometry from towns;

SELECT * FROM towns_test_v;


More information about the Qgis-developer mailing list