I'm working with an atlas in QGIS and have a coverage layer with over 2000 features. Due to the large number of features, it takes a considerable amount of time to load. I'd like to optimize this by limiting the atlas to display only the current feature or a range around the current feature (e.g., $currentfeature +/- 5).

I've attempted to use the "Filter with" option in the Atlas settings with expressions like "id" = @atlas_featureid and "id" = $id, but neither seems to achieve the desired result.

How can I effectively filter the coverage layer to display only the current feature or a specific range around it?


My coverage layer consists of the colored polygons shown in the image below. To set up the Atlas, I can right-click on these polygons and select the desired Atlas, as demonstrated in the image:

selection of features to create atlas

The result is this atlas:

enter image description here

When I don't use a "filter", it cycles through the entire size of the coverage layer (which has over 2000 polygons), making the creation process quite slow. I can implement a static filter like "id" in (10,12,13) and the atlas cycle through polygons 10,12,13 only. I'm curious if there's a way to implement a dynamic filter that limits the number of features in the coverage layer to cycle through, perhaps using something like "id" = @atlas_featureid:

enter image description here

But it seems not taking into account project variables for atlas filtering

  • Thanks for adding in the images. So when you say "when I don't use a 'filter', it cycles through the entire size of the coverage layer" - is this when you are trying to export as a pdf/jpg/svg, QGIS tries to export all 2000+ atlas pages and not the one that you've just indicated? You would like to know how to export only that specific page that you've set the atlas feature for?
    – she_weeds
    Oct 10, 2023 at 9:35
  • Not necessarily, for export. In the dropdown menu close to the export to pdf icon, it shows the entire coverage dataset (>2000 entries). I would like to reduce the size of the features (polygons) for which it creates the atlas.
    – lorenzo
    Oct 10, 2023 at 9:51
  • Ahhh, thank you for the clarification. That makes it much clearer - I think you are right that using atlas variables for the filter is kind of self-referencing so it won't work. I have a somewhat kludgy alternative that I'll post shortly.
    – she_weeds
    Oct 10, 2023 at 10:09

1 Answer 1


Rewritten answer to respond to updated question.

This does require a few more clicks but try using is_selected() in the Atlas Filter and use the Select tool to select which features you want the Atlas to cycle through.

When selecting a new feature you will need to switch the atlas on and off. See below screengrab:

enter image description here

  • Many thanks for the exhaustive answer @she_weeds. However, I really want to limit the features the atlas cycle through, based on the one that is identified in the main project (using right click and select "Set as Atlas feature").
    – lorenzo
    Oct 10, 2023 at 7:50
  • Could you update your question maybe with some screenshots to show exactly what you mean? I'm afraid I don't understand your question - do you mean you have an atlas layer (e.g., countries) and you want to limit the visible features from other layers (e.g. cities) that are outside the active feature? (e.g. only show cities inside the active country?)
    – she_weeds
    Oct 10, 2023 at 7:59
  • I've added some images for clarification.
    – lorenzo
    Oct 10, 2023 at 9:31
  • Answer rewritten to respond to question
    – she_weeds
    Oct 10, 2023 at 10:24
  • Thanks @she_weeds. This is the closest solution to my problem to date.
    – lorenzo
    Oct 10, 2023 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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