I use scale-dependent symbols for mapping (rendering Openstreetmap vectors as it happens). For instance paths show up when zoomed closer than 1:50000, but only roads show when zoomed out.

The rules for rendering are defined to make mapping usable on a monitor screen.

When printing my needs are different - the paper is bigger than the screen so it doesn't follow that the same rules should be used to define the rendering.

In another application I use it is possible to instruct the print layout to render the map using the rules normal for a particular scale even though actually physically printing at a different scale. For example I may want to render the map using the rules normal for a 1:50000 map, but because I want to squeeze the map onto a smaller piece of paper I need to actually print it to be actually at 1:100,000.

At the moment every time I change map extent or scale everything remains connected (changing map extent changes scale changes rendering style etc etc)... so the only option I see is to re-write the complex qml files I use to define rendering styles, so that I have one set of styles for printing and one for on-screen use. Am I missing something? This will be an extremely inefficient way to work.


Here's an approach which should work. In your rules you are creating for your rule based rendering you can put a secondary criteria which matches whether the map is being rendered in a composition or to the main map canvas - this is done using the '$map' variable. $map will be 'canvas' for the main window, or a map item's id if it's being rendered in a composition.

So, in the image below I've set up orange scaled dependent lines for the map canvas and purple scale dependent lines for composer maps:

enter image description here

  • Thank you. That seems to work - although as I noted in other comments I'm still wondering about simpler work-arounds. My filter conditions each end up duplicated - one with "AND $map = 'canvas'" and one with "AND $map != 'canvas'" added to them. I think I hit some issues with the exact position of the rules in the QML file (I find it easier to maintain the styles with a text editor). I think that putting the "!=canvas" rule immediately after the "=canvas" rule meant that rules further down the QML file didn't get rendered at all. Putting the !=canvas rule at the end seems to work. – Rostranimin May 9 '14 at 14:48
  • After playing with this solution for some time I've hit a parallel issue which is worth noting here... if using tiles as a basemap (e.g. from a WMS service or using the Openlayers plugin) there seems no simple way to define what zoom level of tile Composer uses. Composer's resolution setting does change the zoom level... but of course also changes the resolution of the resulting output... so I can have zoomed out tiles only at a rubbish resolution. – Rostranimin May 26 '14 at 19:28

Given what you said, I'll assume you set rule-based rendering, using the zoom as a criterion. Just use two rules for each layer - one to set styles on how you want them on 'normal working scale' for viewing (say anything below 1:100000), and another for a the zoom range in which you build your print maps.

View in the styling tab

In print composer, then insert a map, manually set zoom level to the 1:100,000 you want, and set the dropdown box at the top to 'render' rather then cache. Granted, you'll have to adjust the rendering rules a bit, which is a bit of work initially, but that would be the case in any application.

Print composer settings

Due to you forcing the print composer to fully re-render the image, on a scale level you set for the print, you should force the rendering rules to be enforced for the different scale then your normal 'viewing' in QGis would do.

  • Thank you. Yes I'm using zoom dependent rule-based rendering. I need more information to make complete sense of your answer. It doesn't help that I'm struggling to make sense of the 'render' and 'cache' options. I'm still not clear how to use the two sets of rules. Do you mean to load rules specifically in composer? I did also wonder if there was an easy way to create a layout at whatever size is required to get the correct rendering, but then to magnify/shrink it to print it to fit the paper available. – Rostranimin May 6 '14 at 13:24
  • Added images and a bit of explanation, hope that helps you figure it out. I just kept it simple here - but that naturally applies for combination of layer styles too. – Tim Couwelier May 6 '14 at 13:44

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.