I have a PostGIS multipolygon layer in the map view and want to bring the feature selection into the print composer. Also, only the label for the selected feature should be visible in the map I want to create. enter image description here

  • What do you want to achieve? Feature selection is a tool used in the main window in QGIS, whereas the print composer has other tasks. You can create here e.g. an atlas and define which layer/features should be used. However, as you don't stat what you intention is, it's difficult to guess. Add more information. A screenshot often helps to understand the problem. – Babel Mar 15 at 16:16
  • sorry here's some more information: – geofee Mar 16 at 9:21
  • sorry here's some more information:sorry here's some more information: 1. make a selection with "Select Features by Value" ; "Select Features", "Zoom to Features" 2.update the print composer map with the selected feature "Set Map Extend to Match Main Canvas Extend" 3.automatically grep 3 attribute values from 3 fields of the PostGIS layer; insert the values into label items – geofee Mar 16 at 9:31

Yes, you can:

  1. Use Rule-based symbology.
  2. Use is_selected=True and is_selected=False code lines to filter features.
  3. Make not selected features 100% transparent.

Here is the video: enter image description here


Your use-case seems to be a classical case to use the powerful atlas-function of QGIS: see Creating Detailed Maps with the Atlas Tool and the documentation.

Define a coverage layer - this in your case is the polygon layer. If you set up an atlas in the print composer, QGIS will produce a separate sheet zoomed to each feature of the polygon layer - thus it will do automatically what you did by hand using a selection. All the additional information on the sheet can be configured in the item properties.

To set up an atlas, click the menu Atlas in the print composer and select atlas settings. There, you can click generate an atlas, than define your coverage layer. Than click the map in your print composer and in item settings Controlled by Atlas.

For all elements present in your print composer, you can than set conditions that depend on the current atlas feature - you have at your hand several variable in the expression editor like @atlas_feature, @atlas_featureid etc. that allows you to configure detailed conditions on what should be visible on each individual sheet.

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.