Skip to main content
1 of 2
Stefan
  • 4.5k
  • 1
  • 33
  • 66

How to make a Spatialite View (with geometries) for QGIS based on two table

There are several posts (1), 2)) and manuals to create a spatial view within a Spatialite Database and to work with it in QGIS.

The important thing is to register the view in geometry_columns table:

INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
VALUES ('italy', 'geometry', 'ROWID', 'local_councils', 'geometry');

All examples are about views which were created from one table.

How I have to register this view?

CREATE VIEW photo_object AS
SELECT a.id, MakeLine(b.geom, a.geom) AS geom
FROM object a, photo b
    WHERE a.id=b.id
Stefan
  • 4.5k
  • 1
  • 33
  • 66