http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/sp-view.html
recommend to insert spatial view in *views_geometry_columns.*
Note: I had problems trying to use OGC_FID instead of ROWID as the PK
for the view.
On 23/01/2014 09:26, Geo DrinX wrote:
Hello all,
I noticed a strange behavior in QGis when I am viewing SpatiaLite views.
These are my steps:
1) I have some SpatiaLite tables, that have "Geometry" field. For
example:
CREATE TABLE "Poligoni" (
"PK_UID" INTEGER PRIMARY KEY AUTOINCREMENT,
"field1" TEXT,
"Note" TEXT, "geometry" POLYGON)
2) I create a SpatiaLite view, that performs some spatial opetation,
i.e. an intersection
CREATE VIEW intersecato as
SELECT b.field1as "field1", b."field2" AS "field2", a."field3" AS
"field3",
ST_area (a.Geometry) AS "area", b.arec as "arec",
intersection (a.Geometry, b.Geometry) as Geometry
FROM "Poligoni" a, "otherTable" b
where
ST_intersects (a.Geometry, b.Geometry) = 1
order by field1
3) I insert into "geometry_columns" a record for the view:
insert into geometry_columns values
('intersecato','geometry',3,2,3003,0)
4) I execute a query into SpatiaLite_gui to control that some record
exists.
And... they exist. :)
5) I go to QGis (2.0.1 Dufour, Windows, Linux or MacOSX :) and
connect to SpatiaLite DB.
6) I insert my tables and view in Layer list.
We, now I see all the layers, as those corresponding to the tables, as
that correspond to my SpatiaLite view. But, this one do not display
the correct records in the attribute panel: in this case, I only have
a list of many "NULL", and selecting a record, all records are
selected :(
Do you have any explanation for this?
Also I tried to add a PK_UID in the view definition, but the result
remains the same.
Thank you for any help
Regards
Roberto
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer