1

I'm having trouble using the "Grids" option in the QGIS 6.3 composer layout. If I define the Interval units in Centimeters the coordinates on the map (text) are NOT referenced to the coordinate systems, in my case it is 4674, they are relative to the intervals and not in real coordinates. enter image description here

If I change to MAP UNIT, the coordinate texts conform to the 4674 system, but in combination with the use of the ATLAS option, which automates several maps with different scales, I get a GRID variation on the map, which on a certain scale(1/500) is with good spacing and for smaller scales (1/3000) is very close spacing, overlapping the coordinates lines and text. enter image description here

What could it be to do to correct? It would be possible to maintain grid spacing in centimeters, but would the grid text be referenced to the coordinates system? Or, allow the use of formula so that the grid spacing varies according to the map scale controlled by ATLAS? Any suggestion?

  • As a workaround, you could create several different grid items at different scales. Then make the item visibility data-defined depending on the map scale. – csk Jun 16 at 18:15
  • May you tell me how can i do this and use with Atlas? – Denilson Jun 17 at 2:01
  • For me, the better ideia is define de grid interval in centimeters, but the label os coordinates are not real, the is relative of the corner of the grid start with 0,0. Could be a bug of QGIS? – Denilson Jun 17 at 2:06
  • You could create a grid in a projected coordinate system, using the map unit (in meters), and to transform the printed coordinates (get the grid X/Y, reproject to 4674, print coordinates) – JGH Jun 17 at 13:14
1

As a workaround, create a separate grid for each scale range in your atlas. Make the visibility of each grid dependent on the scale level of the main map.

  1. Make a new map item with no map content (turn off all the map layers, refresh the map item so that it's blank, and lock the layers for this map). We'll call this map item the grid map.

  2. Give the grid map a grid for the first scale range. Change the item name to "grid map, [scale range]", where [scale range] is the range of scales when you want to see this grid. For example, "grid map, scale 1:1,000,000 to 1:500,000"

  3. Turn off the background for the grid map, and put it on top of the main map. Re-size the grid map so it's exactly the same size as the main map item. Now you should be able to see the original map through the grid map.

  4. Set the scale for the grid map to be dependent on the scale of the main map, using this expression (exchange 'main map' for the item id of your main map):

    map_get( item_variables('main map'),'map_scale')
    

    Note that the map_scale variable is the denominator of the scale ratio. Eg, if the scale is 1:1,000,000, the map_scale variable = 1000000.

  5. Set the opacity of the grid map (in the Rendering section of the Item Properties panel) to 100% when its scale is within the appropriate scale range, and 0% when its scale is outside that range. Eg, for the scale range 1:1,000,000 (inclusive) to 1:500,000 (exclusive), use this expression:

    if(@map_scale <= 1000000 and @map_scale >500000, 100, 0)
    
  6. Make a copy of the grid map (select it, Ctrl-C, Ctrl-V). Change the name of the copy to the next scale range, and repeat steps 1-5.

  7. Repeat until you have a separate grid map for each scale level.

    enter image description here

  • It work very well – Denilson Jun 22 at 0:59

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.