My grid overlaps labels placed on a map.

Is there a way of forcing the labels to be displayed in front/on top and the grid placed behind the text?

Despite looking I cannot find a solution.


Using QGIS 2.18.15

  • Are your labels part of the imagery layer or tied to a separate vector layer? – JoshC Feb 4 '18 at 17:17
  • @JoshC they are a separate line vector layer – Beaver Feb 5 '18 at 3:47

Here is an effective workaround using visibility presets.

  1. In your Layers Panel, select only the vector layer which contains the labels to be visible.
  2. It looks like this is already the case in your project, but ensure that any features in this layer are transparent, and that only the labels are visible.
  3. Under Manage Layer Visibility (the eyeball button), select Add Preset.
  4. Name your new preset labels.

  5. Now go into your Composer window. Once Map 0 is positioned how you like it, duplicate it. There's no specific command for this, just copy and paste.

  6. Position Map 1 directly on top of Map 0.
  7. Under Map 1 > Item Properties > Layers, check Follow visibility preset and select labels.
  8. Make sure that your grid is assigned to Map 0, and that Map 1 is listed first in the Items panel.

Note that this solution only works as long as long as both maps are set to the same extent and scale. It's possible to have Map 1 obtain its extent/scale values from Map 0, but this may be more work than it's worth unless you plan to frequently adjust your map in the Composer window.

image of labels over gridlines

| improve this answer | |

Another solution, maybe simpler, is to create your grid as a vector layer, using the "create grid" tool in the processing toolbox. You can then style it exactly as you want, and the labels will automatically go above it (and even avoid it if you want).

| improve this answer | |
  • 1
    I'd considered that when I was writing up my answer, but the resulting output just doesn't have the same labeling options as a composer grid. Having the grid labels outside the box, for example, is impossible when using a vector layer. – JoshC Feb 6 '18 at 4:49

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.