[Qgis-developer] virtual fields

kimaidou kimaidou at gmail.com
Mon Mar 3 07:43:13 PST 2014


I have many people asking for this kind of "virtual fields". The first time
I show people the field calculator during curses, people often tell me :

* I have done a mistake, how can I change the formula and see the result
updated ? -> they often compare this feature to the excel formula
* I do not want to create a new column, just use it for labelling/styling .
I answer them "Just use expressions in the label/style pannel" and they
answer back "But how can I preview the results in the attribute table for
all features before ?"

This is definitely a nice feature to have. We must take performance into
account though, for big datasets.


2014-03-03 16:36 GMT+01:00 Martin Dobias <wonder.sk at gmail.com>:

> Hi Denis
> On Mon, Mar 3, 2014 at 9:49 PM, Denis Rouzaud <denis.rouzaud at gmail.com>
> wrote:
> > Hi all,
> >
> > I was wondering about the idea of being able to create simple views in
> > "views" in terms of database.
> > Often, I use views (in postgres) to be able to create labels, title,
> simple
> > calculation or whatever and also to combine data from joined tables.
> >
> > Somehow, all is already there in QGIS but in distinct features:
> > - joins which will add the fields of the joined table to the main table
> > - expressions are used in many places where views are meaningful: labels,
> > styling, search, etc.
> > - field calculation
> >
> > I was thinking that these features should be grouped and improved in what
> > could be called virtual fields -- so basically a "live" field calculation
> > without writing to the provider.
> >
> > First, the idea would be to define virtual fields using expressions.
> I have thought about this functionality before and I think it should
> be relatively easy to add this functionality. The
> QgsVectorLayerFeatureIterator could simply compute the values of the
> virtual fields according to their definition in QgsVectorLayer. It
> should automatically work lazily - if the field is not requested, it
> would not be evaluated.
> > Then, it should be made possible to integrate the joined fields in qgis
> > expressions without adding them to the current attributes (as it is now).
> > One way to to it could be a function: joinField( joinName,
> joinedFieldName)
> > Hence, the user would be allowed to choose which joined fields he really
> > wants to be accessible in the layer.
> Do we actually need such functionality? Wouldn't it be enough to hide
> the attributes you don't want?
> Regards
> Martin
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140303/a23fc348/attachment.html>

More information about the Qgis-developer mailing list