[GIS] QGIS print composer: can I select features whose attributes to show

print-composerqgis

I am using the atlas to generate a number of maps. Each map is of a particular zone represented by a multiline vector layer. I have another layer with point data and each map has an attribute table with the point data. It seems that I have just two choices:

  1. I can have all the points in the table
  2. or I can have just those points that are visible on the map

I want a third possibility: just those points associated with the zone. i.e. an option to filter points relative to the 'current' feature — something like "zone" = atlas.zone_name.

Best Answer

It's possible in the current development version of QGIS (which will eventually become 2.6 - there's instructions on how to obtain development snapshots here), and a potential workaround is available in 2.4.

Both methods are done by checking the "Filter with" checkbox under the table's "item properties" tab, and entering a filter expression.

In development snapshots:

Assuming your point layer has a column called "zone", and the zone table has a column "zone_name", you would set the attribute table's filter to something like:

"zone" = attribute(  $atlasfeature ,'zone_name')

In QGIS 2.4

While you can't do a filter using attributes from the atlas layer, you can use a geographic filter from the table with the atlas. This may or may not work for your particular use case. The expression would be something like this:

intersects(  buffer ( $geometry , 10), $atlasgeometry )

This would show points within 10 map units of your atlas multiline layer.

Related Question