QGIS – Setting Grid Position Behind Map in Print Layout

layoutsmappingqgisraster

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?

Best Answer

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

Related Question