[Qgis-user] Filter map layer based on report

Nyall Dawson nyall.dawson at gmail.com
Mon Jan 7 16:13:17 PST 2019


On Tue, 8 Jan 2019 at 10:10, Spencer Gardner <spencergardner at gmail.com> wrote:
>
> Ah, interesting. Thanks Nyall. This raises the question of whether the variable names related to Atlas need to be renamed (or duplicated) to reflect their applicability to both reports and atlas. Perhaps you've already had discussions?

Not yet -- but yes, it's rather counter-intuitive!

Nyall

>
> On Mon, Jan 7, 2019 at 3:56 PM Nyall Dawson <nyall.dawson at gmail.com> wrote:
>>
>> On Tue, 8 Jan 2019 at 07:39, Spencer Gardner <spencergardner at gmail.com> wrote:
>> >
>> > I'm using QGIS3 to create a report. One of my tasks is to display only features in a map layer that match the current iterated feature in the report. To be specific, my report body is set to iterate over a "stations" layer and I have an layer of intersection points where an intersection should only be displayed if it is associated the the current station (via an attribute called "station_name").
>> >
>> > With Atlas, this could be done by setting the atlas page name to "station_name" from the stations layer and then setting symbology on the intersections layer using
>> >     "station_name" = @atlas_pagename.
>> > Is there a comparable solution for a report? I don't see any relevant variables.
>>
>> Use @atlas_feature, e.g.
>>
>> attribute(@atlas_feature, 'STATION_NAME') = "STATION_NAME"
>>
>> This takes the STATION_NAME attribute value from the current
>> atlas/report feature, and compares it against the station_name
>> attribute from your "stations" layer. Be careful of the quoting here
>> -- the first field name, in the attribute function, is a string
>> literal so uses single quotes. The value you are comparing against is
>> a field reference, so needs double quotes.
>>
>> Nyall


More information about the Qgis-user mailing list