[Qgis-developer] Viewing SpatiaLite views in QGis
vincent.mora at oslandia.com
Thu Jan 23 04:36:24 PST 2014
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
> 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
> ST_area (a.Geometry) AS "area", b.arec as "arec",
> intersection (a.Geometry, b.Geometry) as Geometry
> FROM "Poligoni" a, "otherTable" b
> 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
> 4) I execute a query into SpatiaLite_gui to control that some record
> 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
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer