5

I have created a map in the print layout in QGIS. Once the coordinate grids are added to the map, they overlay the current map that I actually want to show.

image

For me, grids are just secondary information but right now they cut through the real informative map. I would like to position them behind the map, so they only show in the white space outside the map e.g.

map2

How can I change the position of the map to superposition, and the grid lines to supposition?

6
  • Have you tried changing the style of the grid?
    – Erik
    Jan 6, 2022 at 14:01
  • Under the sub-category Grids? Yes, there is no such thing there where I can change the position of the grid lines relative to the map itself
    – Thomas
    Jan 6, 2022 at 14:04
  • You may try to create your grid as a layer, then you could place it anywhere between your layer
    – J.R
    Jan 6, 2022 at 14:08
  • That was my worry too @J.R. Seems odd you cannot change the position of grid lines and map immediately in the print layout.
    – Thomas
    Jan 6, 2022 at 14:10
  • 2
    You may also try to play with the blend mode and line opacity of the grid you may be able to find a combination of setting that give an acceptable result
    – J.R
    Jan 6, 2022 at 15:01

3 Answers 3

5

Interesting question. I have been thinking about this for the last few hours and have been playing with a workaround- here is the basics of a rough example. The concept involves using two map items in the layout. Add the first map item to the layout, and adjust the scale and extent to your liking. Create a grid for this map item and adjust the spacing, frame, draw coordinates and any other grid properties you want. Next, turn off layer/s in the main map canvas, refresh the layout and lock layers and styles for this first map. Now go back to the main canvas and turn your layer/s back on. Now head back to the layout and add a new map item on top of the first. Turn off the background on Map item 2 so essentially you have a vector layer with a transparent background sitting on top of the grid for map item 1. The only thing is you need to set the scale and extents for map item 2 so that they match map 1 exactly. I admit is it a bit fiddly to adjust frames, scales extents etc. but with some playing around you should be able to get a reasonable result. I put together the layout below fairly quickly just to show the idea:

enter image description here

I also recorded the short screencast below. Just for demonstration, I have unlocked layers on the first map and refreshed the layout. Here, I am turning map 2 on and off so you can see the map with transparent background sitting on top of the grid and the 2 vectors lining up.

enter image description here

5
  • Great answer. Its one of these answers that are obvious once you had the idea - but first you have to have the idea. Great job!
    – Babel
    Jan 7, 2022 at 11:31
  • Thank you @Babel!
    – Ben W
    Jan 7, 2022 at 12:13
  • You could probably use data defined override to get the second map item to synchronize with the first
    – J.R
    Jan 7, 2022 at 12:28
  • 1
    Thank you @BenW. I think this is the smartest workaround indeed!
    – Thomas
    Jan 7, 2022 at 15:32
  • Thanks @Thomas, you're welcome!
    – Ben W
    Jan 8, 2022 at 7:22
2

Duplication and synchronisation of the map is definitely the key to solve this issue, as @BenW already suggested. The map underneath should contain the grid afterwards.

But there's one question missing: how can we easily synchronise "Map 1" with "Map 2"?

For map synchronisation we can simply define an Overview in the grid map ("Map 2") targeting "Map 1", enable "Center on overview" and disable frame style (Fill style: no brush, Stroke style: no pen). Then we have to overwrite the map scale of "Map 2" with the following expression: map_get( item_variables( 'Map 1'),'map_scale')

That's it, "Map 2" will follow "Map 1" immediately.

(The idea for map synchronistion was born here: Synchronizing views in QGIS print composer?)

1
  1. Set the color of the grid to transparent. It will be invisible

  2. Set Frame Style to Exterior Ticks: outside the map, you will have small lines.

enter image description here

1
  • 1
    guess you can set "Grid type" to "Frame and annotations only" instead of setting grid color to transparent.
    – christoph
    Jan 9, 2022 at 18:43

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.