Hello Enrico,
QGIS implements an older arrangement from the first version of Spatialite.
The views share metadata with tables in geometry_columns.
I think that QGIS should use the proper metadata table as well. It's time
to do it as Spatialite is at version 4 and the views_geometry_columns comes
from version 2.4 or so. Probably it could handle both metadata for
compatibility, after enforcing the wrong arrangement for years.
Anyhow, to solve your problem, just add an entry in geometry_columns.
c

On Thu, Sep 29, 2016 at 9:00 PM, Enrico Fiore wrote:

> Date: Thu, 29 Sep 2016 16:07:25 +0200 (CEST)
> From: Enrico Fiore <enricofi...@libero.it>
> To: QGIS User List <qgis-user@lists.osgeo.org>
> Subject: [Qgis-user] QGIS 2.16 DB Manager and spatialite view
> Message-ID:
>         <360816939.108261475158045364.JavaMail.defaultUser@defaultHost>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> I have created a database with spatialite_gui tool, the database has some
> spatial views created with a code like this
>
> CREATE VIEW comunitorino AS
> SELECT c.ROWID as rowid, c.cod_com, c.geometry
> from comuni c;
>
> INSERT INTO views_geometry_columns
>     (view_name, view_geometry, view_rowid, f_table_name,
> f_geometry_column,read_only)
>   VALUES ('comunitorino', 'geometry', 'rowid', 'comuni', 'geometry',1)
>
> The view can be load in QGIS by 'add spatialite layer' button
>
> The problem is that if I use DB Manager and open the DB the view will not
> be seen as spatial view.
>
> If I create the view in DB Manger with the "Create a view" button the view
> will be seen as spatial view.
>
> Where is the mistake?
>
> Thanks
>
> Enrico
>

-- 
--------------------------------------------------------------------------
Carlo A. Bertelli
   Charta servizi e sistemi per il territorio e la storia ambientale srl
          Dipendenze del palazzo Doria,
          vc. alla Chiesa della Maddalena 9/2 16124      Genova (Italy)
          tel./fax +39(0)10 2475439  +39 0108566195  gsm:+39 393 1590711
   e-mail: berte...@chartasrl.eu      http://www.chartasrl.eu
--------------------------------------------------------------------------
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to