[Qgis-user] Filter map layer based on report

Nyall Dawson nyall.dawson at gmail.com
Mon Jan 7 15:56:27 PST 2019


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