[Qgis-developer] Expression context and custom functions

Nyall Dawson nyall.dawson at gmail.com
Sun Sep 13 02:50:32 PDT 2015


On 11 September 2015 at 23:53, Hugo Mercier <hugo.mercier at oslandia.com> wrote:

> Another question: I am trying to access the current atlas geometry from
> a plugin, but fail to do so.
> From the python console, with a atlas in preview mode :
> QgsExpression.specialColumn("$atlasgeometry") -> None
> QgsExpression("$atlasgeometry").evaluate() -> None
>
> However, if I set a layer's label to "$atlasfeatureid", I get the right
> label ...
>
> Is it intended ? I guess that is because the "global" expression
> evaluation has no atlas context ?

That's true. Is there any reason you aren't accessing the atlas
feature/geometry directly? Why go through the expression engine to
retrieve this?

Nyall


More information about the Qgis-developer mailing list