6

Example

I want to remove the labels in the second, smaller map. So far when I switch off all the labels and refresh only the smaller map, of course, the labels are not shown. But it seems like QGIS updates also the other map when I save the map as pdf.

Is there a way to show in this map only the labels from the Rettungsleitpunkte and exclude all the others?

6

Locking layers will certainly work, but I wanted to make sure there were a few other methods represented in the answers here.

I'll work with the following lines layer. As you can see, the features are already labeled.

roads

Method One: Data-Driven Solution

Data-driven solutions are my favorite, because if you do them right, they always work. To set this up, first go to your layout, and under the Item Properties of your main map, set the Item ID to something. I've chosen Map 1.

map id properties

We'll need to use Rule-based labeling. Open up the default rule that appears.

rule-based label

In the Filter text box, enter the expression @map_id IN ('Map 1', 'canvas'). We put canvas in there to ensure that we can still see the labels in our main window.

With that filter in place, only Map 1 will have labels, regardless of layer locks, styling, scale, etc.

id-based labeling

Method Two: Scale-based Labels

Given that overview maps are smaller scale than their counterpart maps, you can also set a scale boundary on your labels. This method only requires a single layer, and no themes or locking on the Layout view.

Again, we'll use Rule-based labeling. You don't actually have to establish any rules, though. Simply apply a minimum scale which is larger (i.e., a smaller number) than the scale of your overview:

scale based labels

scale based label maps

Method Drawbacks

It's minor, but if you are adjusting the size and scale of your layout items, you may need to adjust the value on your label scale limit.

Method Three: Map Themes and Duplicate Layers

Establish the Main Theme

Get your map styled the way you want in your map. In the Layers pane, click on the Manage Map Themes (the eyeball) icon, then select Add Theme... and name it however you like. I'll name mine "Main Theme".

enter image description here

Duplicate Layer and Establish Overview Theme

Right-click your labeled layer in the Layers pane and select Duplicate Layer. Rename the new layer something like "Your Layer - Overview".

In the Layer Styling pane, turn the labels off for this new layer. With the new layer on and the original off, add a new theme. Mine will be called "Overview".

If you are doing this with multiple layers, you may want to add groups to your Layers pane.

layers panel with groups

Layout: Link Maps to Themes

In you layout view, select your main map. Under Item Properties, check the box next to Follow map theme and select the "Main Map" theme. Do the same for the overview map, selecting the corresponding theme.

two maps with different layer themes

Method Drawbacks

Using this method does have the drawback that your layer symbols are separate. Changing the styling of one will not automatically update the other. To get around this, you can right-click one layer and copy its symbology, then right-click the other and paste it. The Copy Style menu allows you to copy the symbols only, so you can safely avoid adding labels to the other layer.

copy symbology only

4

Take a look at the small checkboxes "Lock Layers" and "Lock styles for layers" within Itemproperties of your printcomposer:

enter image description here

Choose your main map and tick them.

Now go back to your main window of QGIS and remove the label option, e.g. set them blocked.

Now go back to printcomposer and refresh it.

enter image description here

2

In the map canvas properties you can lock the layers shown in said canvas, and also their symbology. Style one of your maps, then lock it, then style the other, then print your map.

enter image description here

Also you might want to take a look at the overview function, since this makes locating your large canvas in the smaller one way easier.

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.