At Show only features within current Atlas feature I learned a valuable way of using Atlas. I need to move it a step further but lack the skill.

How do I filter the atlas using geometry of other layers?

I don’t know how to reference a layer in the command line. If I use this:

intersects( $geometry , @atlas_geometry )

Then it only works for the current geometry. But the current geometry is from the atlas layer, I need to use a different layer geometry that I need to reference (I know this must be possible, but dont know how to do it). What I want to do is to filter the atlas, so that only areal units that have certain points in them are shown and exported.

2 Answers 2


For my understanding, you want to apply a filter to your atlas layer based on other layer geometry.

In the layout control panel, you can set a filter applied on your atlas layer to get atlas produced only for some feature of your atlas layer. Just click in the epsilon icon.

enter image description here

The formula will be really simple with the function overlay_intersects() (it is present since QGIS 3.16 version).

overlay_intersects( 'New_scratch_layer_d419445a_e71d_44d4_b0ca_e1a6dbb86b17')

Replace 'New_scratch_layer_d419445a_e71d_44d4_b0ca_e1a6dbb86b17' with your layer name or id. You could access it with the expression toolbox, just double click in the layer name you want to use.

enter image description here

  • Thank you very much. This is so simple, I feel a bit dumb. Thanks. Dec 3, 2021 at 14:23
  • It is really new function so normal not to know it. Dec 4, 2021 at 13:20

In older versions than QGIS 3.16 you can use aggregate() to test the intersection against a whole layer.

As "Filter with" argument in the atlas properties use: intersects(aggregate('LayerName','collect',$geometry), @atlas_geometry)

You can also add a filter to the aggregate() function, to only use parts of the layer, for example: intersects(aggregate('LayerName','collect',$geometry,filter:=$id<>11), @atlas_geometry)

enter image description here

  • Cool way to do it, thank you. Dec 3, 2021 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.