[Qgis-developer] Questions/Suggestion on virtual layers

Hugo Mercier hugo.mercier at oslandia.com
Wed Mar 2 08:17:12 PST 2016


Hi Andreas,

On 02/03/2016 16:27, Neumann, Andreas wrote:
> Hi,
> 
> I am experimenting with the virtual layers. They are quite cool!
> 
> I have some suggesions/questions:
> 
>  
> 
>  1. It would be nice to have a preview of my query results. Currently it
>     is either it works - or not. If it works, but the results are wrong
>     you have to start from scratch. I would suggest that when you press
>     on the test button you would not only display "No error" or the
>     error message, but maybe the first 10 rows of the result.

True.
Note that you can also create a virtual layer using the DB Manager where
it can display the first rows of a query, as it is the case for other
databases.
I am not sure to love having these two very close but slightly different
dialogs. If anyone has a better idea in terms of usability, do not
hesitate to propose :)

>  2. Updating the virtual layer: it would be really nice if I could
>     edit/improve on my virtual layers without having to start completely
>     from scratch. --> Oh - now I found out that if you select an
>     existing virtual layer and then use "Layer" --> "Add Layer" --> "Add
>     Virtual Layer", that you can refresh an existing virtual layer. This
>     is really not obvious. I think this is more a usability issue.

Yes ... I am more used to click on the addition icon, which makes it
more direct, but you are right, this is not perfect.

An entry in the right-click menu ?

Edit - you can also use the drop down menu of the creation dialog to
switch between different virtual layer definitions, as mentioned by Yves

>  3. it is not very obvious how you can reuse an already existing
>     geometry column. I discovered it by accident, that you can use
>     layer.geometry (regardless of the original name of the geometry
>     column), but I think that it is not obvious. A better hint in the
>     the tooltip would probably help.

Indeed it appears to be not documented.

>  4. Unique identifier column: If you join several tables, you often have
>     the issue that you need to create an artificial primary key. Could
>     we offer a preconfigured builtin pkey - something like a rowid  for
>     such cases?

Good point. An autoincremented id is already generated on the feature.
That may not be a problem to add a "rowid" column in that case.

>  5. What is the exact purpose of the "Embedded Layers" where you can
>     add/import/remove layers? I noticed that existing layers of the
>     project work anyway without adding/importing them first. Is the idea
>     that you can work on layers that aren't in the project?

Yes it is.
You can for example embed layers from the project, save the virtual
layer to a QLR and reload it in a new project, the referenced layers
would not need to be already loaded.
There may be some documentation needed as well here.

> 
>  
> 
> Should I open feature request tickets for these or are there already
> plans to address one or the other of the above issues?

Unfortunately, no plan yet.
Thanks for your tests and feedback !




More information about the Qgis-developer mailing list