Add a Grid to a map window by clicking on the Grid virtual layer in the Layers pane.
This topic discusses the use of a Grid virtual layer in a map. For info on adding grids to frames to Layouts, see the Layouts: Grids topic.
The Layers pane shows three virtual layers at the top of the layers pane display stack for map, drawing, image, and labels windows. Virtual layers are off by default.
Click on the corresponding virtual layer's on/off box to turn on a North arrow, a scale bar, a legend, or a grid as part of the display in the window.
Clicking the Grid layer on adds a default Grid to the active window. The default grid color, black, does not show up well when the background of the map is a dark, satellite photo display.
Configure a Grid in a map by double-clicking the Grid virtual layer in the Layers pane. That opens the Grid dialog. We will want to change at least the stroke color, so the grid is more visible against the dark background.
The Grid dialog allows setting the following parameters:
Shows a preview of the current settings used in the dialog. The background color is light blue by default, to allow either very light or dark styles to be visible. Change the background color of the preview pane by clicking the square box in the upper right corner of the preview pane.
Choose a Grid style from the gallery. Hovering the mouse over a shape will show the name of that shape in a tooltip.
Foreground and stroke color for grid styles.
Color for halos.
Buttons that show a small "box" sub-icon indicate that color has been changed from the default.
Dash pattern for lines, using the same conventions as the Dashes parameter for line styles. Default: 3,3 for a 3pt dash and 3 pt space.
Stroke width for line and point styles.
Size for point styles.
Width in points of halo for line and point styles. Setting Halo to 0 turns off the halo.
Use latitude / longitude
Check to create a latitude / longitude grid. Default: off, meaning to use the projection of the map. Latitude / longitude grids render parallels only from -90 to 90 degrees and meridians from -180 to 180 degrees.
Minimum size of a grid cell in X and Y dimensions. The actual size is computed based on the scale of the map and the units used (either native map units or latitude / longitude). Default: 1.
Increase step on zoom out
On zooming out, so the map displays larger areas, automatically increase the step (the size of grid cells). On by default. If turned off, grid cells will never become larger than the specified step. If the displayed size of grid cells becomes too small when zooming out, the grid will not be rendered.
Unit of measure used for the grid step. Default: coordinate system unit for the map window, specified by choosing (auto).
Press to apply the current dialog settings to the map.
The grid step used for display is selected automatically based on the specified minimum step and the current scale. The grid step in the units used (either the projection of the map or latitude / longitude) is rounded up to the closest power of 10 multiplied by 1, 2 or 5, resulting in grid steps such as 100, 200, 500, 1000, and so on.
We configure a default Grid by setting desired parameters.
Double-clicking the Grid virtual layer in the Layers pane to open the Grid dialog.
Specify options as shown above. The grid uses white foreground/stroke color so it is barely visible in the preview. We have specified a thin stroke width so the grid will be subtle.
We check the Use latitude / longitude box and choose Degree as the Unit. Using a Step of 1 means to draw a grid that is at least one degree between grid borders. We have checked the Increase step on zoom out so the grid will automatically resize itself as we zoom out.
We can experiment by changing settings and pressing the Apply button to see what happens.
Press the OK button.
The Grid now appears using the style specified, appearing as a visible grid using white foreground/stroke color. If we hover the mouse over grid lines, we see that at this zoom level the grid lines have been drawn five degrees apart in both latitude and longitude.
Grids automatically resize by default when we zoom in and out if we check the Increase step on zoom out box in the Grid dialog. We can see how that works by zooming in and zooming out.
To see how the grid automatically adjusts to zoom, we can right-click-and-drag a zoom box as shown above, to zoom in.
As we zoom in, the grid automatically resizes so the grid lines are one degree apart in both latitude and longitude. Since we have specified a minimum Step of one degree, if we continue zooming in the grid lines will always remain one degree apart. If we zoom into a region that is not an even one degree latitude or longitude location, no grid lines will appear.
Suppose instead of zooming in, we had zoomed out:
The grid automatically resizes so that now there are ten degrees between longitude and latitude grid lines. The system tries to adjust the grid step so that there is a reasonably even number of degrees between lines and also so that lines are not too close or too far together for a reasonable visual effect.
Suppose we launch the Grid dialog again by double-clicking the Grid virtual layer in the Layers pane, and we uncheck the Increase step on zoom out box in the Grid dialog.
The grid now disappears, because if the system is not allowed to increase the step on zoom out, the minimum step we have specified of only one degree will result in too visually dense a display.
The grid will only reappear if we zoom in to where a one degree latitude and longitude grid will not be too dense.
Snap to Grid - When using Snap Modes, the Snap to Grid mode will snap the cursor to grid intersections whether the virtual grid layer is on or off. When snapping to a grid, we would normally uncheck the Increase step on zoom out box in the Grid dialog, so that the grid to which we snap will not change if we zoom out or in.
Projections Matter - Grids depend on the coordinate system / projection in use. Many projections that have varying linear sizes will therefore have the same visual grid size but with varying distances in the grid when using grids based on linear units, with grid dimensions being true only where scale is true in the projection in use. Use a latitude / longitude grid to see varying grid sizes that provide latitude and longitude dimensions in various projections.