[Qgis-developer] Getting access to atlas record

Martin Dobias wonder.sk at gmail.com
Thu Jun 19 22:43:50 PDT 2014


On Fri, Jun 20, 2014 at 12:29 PM, Nyall Dawson <nyall.dawson at gmail.com> wrote:
> On 20 June 2014 15:18, Martin Dobias <wonder.sk at gmail.com> wrote:
>
>>
>> May I suggest an alternative approach: to introduce dot notation, e.g.
>> $atlasfeature.area_code - that looks much more like SQL syntax and it
>> is easier to remember and use. It would require small adjustments to
>> the parser and evaluator in order to support "nested" objects, but I
>> think it would be worth it. I could help with that if needed.
>
> What about evaluating a column name on the fly though? How could this
> be handled? Maybe both ways should be supported...

Actually the dot syntax would imply on the fly evaluation. When
parsing, it is not possible to decide what will be the content of an
object.

This would be similar to python: the expression x.y means that in
object x it should look up "x" in the dictionary of attributes and
return its value.


>>
>> This would need some extra care: the expression tells in
>> referencedColumns() call what fields are going to be used. If we
>> support thing like this, we need to ensure that all attributes are
>> fetched.
>
> That's exactly why I held off on this for 2.4 -- I've had to introduce
> a "usesAllColumns()" function to indicate that all columns are
> required, not just those from the referencedColumns() list. This
> requires changes to a wide scattering of code throughout QGIS to take
> advantage of this, and not just rely on referencedColumns to determine
> the subset to fetch.

I see. Another option could be to have a special column name that
would indicate that all columns are needed - this special name would
be understood by QgsFeatureRequest. That would keep the usage of
QgsExpression same as before, without having to discriminate between
the two cases...

Regards
Martin


More information about the Qgis-developer mailing list