I want to create PDF-maps showing polygons/areas automated by using the Atlas generation.

I have a SHP-file that contains polygons and every polygon/feature (in the attribute table) has an ID that I can use to filter these polygons and only show polygons with a certain ID. So sometimes there is only one polygon assigned to let's say ID "X", but then there are cases where several polygons/features are assigned to ID "Y".

When I generate the atlas using the rule based symbology ($id = @atlas_featureid) it creates an individual map for each polygon with the ID "Y" instead of one map with all "Y"-polygons.

How can I create (with the Atlas tool) maps that show all polygons with a certain ID (be it one or more polygons)? So the goal is to create for each ID a map that shows all the features/polygons with that specific ID.

I can achieve this manually of course by just applying a filter on the SHP-file layer and select each ID manually, but I would prefer an automated way with the Atlas.

I'm using QGIS 3.6.1.

2 Answers 2


Instead of dissolve then what you need is the "collect" aggregate. This can be run as a standalone processing tool in QGIS from the processing toolbox, selecting ID as the attribute to group by.

With your labeling, if the labels are the same for each polygon that has the same ID value, you can have a label displayed over each part (Label every part of multipart feature). If the labels are to be different though, then as you say you will have to retain your original layer to use for labeling - you can disable the symbology from showing up.

  • Thanks, "collecting" solves the polygon issue, they are shown correctly now. But the labelling still gives me headaches if I have several polygons with uniqge labels under the same ID. The "label" from the "collected" layer is just one of the labels from the original SHP-layer. I can use the original layer to show labels, but then it shows the labels of all polygons and not the ones of the current ID in the atlas. I don't get how I could filter this so it shows only all the labels for the polygons that are shown under the current ID in the atlas. Jun 10, 2020 at 7:22
  • 2
    What you're seeing with the labels in the collected layer is how it's meant to work. It's not possible to group polygons together while having separate records for all the other attributes. To filter out your labels from the original layer, try an expression like "ID" = attribute(@atlas_feature,'ID') where the atlas is set to your collected layer
    – she_weeds
    Jun 10, 2020 at 8:22
  • Thanks. I was looking for a code that could do this, but couldn't think of any. So wrapping up the solution for my problem: Use "collect" and group by ID on the layer that contains the polygons, IDs and unique labels. The collected layer shows now all polygons that are attributed with a certain ID on one map (of the atlas; ID is the page name). To get the correct labels shown for each polygon, I have to activate the source layer and apply this expression "ID" = attribute(@atlas_feature,'ID') in the label rule-based label section and deactivate the symbology. Looks like everything works. Thanks Jun 10, 2020 at 8:40

You could dissolve (dissolve field = ID) the features you use for atlas creation. To display the atlas you could still show the initial shapefile (in case other attributes are displayed) and filter it depending on the atlas_featureid.

  • Thanks, this helps almost. I just noticed though that polygons which are next to each other are dissolved into a bigger polygon. That's not the desired result. Also each polygon has an individual label in a column "label" which needs to be displayed on the map for every single polygon. I guess you can do that with the original shp-file and filter it by atlas_featureid Jun 9, 2020 at 7:30
  • This is exactly what I meant: you use the dissolved polygons B for atlas creation (you don't need to display it) and the original shapefiles A to display the features on the map. You can then filter A by id values from B. Probably there is also a more elegant option. I would recomment you to have also a look at the answer from @she_weeds
    – salamandra
    Jun 9, 2020 at 13:29
  • Thanks salamandra. In my case collecting was the right tool. See above for the full solution (also including the labels). Jun 10, 2020 at 8:41

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.