[QGIS-Developer] Problem with symbology rule containing @atlas_featureid

Nyall Dawson nyall.dawson at gmail.com
Wed Mar 28 15:07:36 PDT 2018


On 26 March 2018 at 14:40, Nyall Dawson <nyall.dawson at gmail.com> wrote:
> On 24 March 2018 at 10:22, Nyall Dawson <nyall.dawson at gmail.com> wrote:
>> On 23 March 2018 at 22:47, Andreas Neumann <a.neumann at carto.net> wrote:
>>> Hi,
>>>
>>> I noticed a big problem in the rule based renderer when PostgreSQL layers
>>> are involved and the rule contains @atlas_featureid.
>>>
>>> As an example, I use this rule:
>>>
>>> $id != @atlas_featureid
>>>
>>> When I click on the "Test" button I get "Filter returned xxxx features". So
>>> far so good. But the bad thing: nothing is drawn on the canvas!
>>>
>>> Could it be that the expression compiler tries to forward this query, but
>>> PostgreSQL knows nothing about @atlas_featurid ?
>>>
>>> Can someone confirm that this really is the case before I file an issues
>>> report?
>>
>> Confirmed - think I can see an easy fix for this.
>
> I take that back - I'd made a mistake. Can you open a ticket and share
> a project demonstrating this?
>

For future reference, this is fixed now. It was caused by the canvas
initially having the @atlas_featureid variable having a null value
(until an atlas is opened), so the expression was effectively $id !=
NULL (which is always false).

In contrast the Test button would set a @atlas_featureid to 0 if a
real feature id wasn't available - so it was reporting matching
features.

Now the canvas uses the same approach as the test button and defaults
@atlas_featureid to 0 if it's not yet set.

Nyall


More information about the QGIS-Developer mailing list