6

I have had a good google about this and can't find anything on it. is it possible to offset grid labels from the grid basically trying to move the label to where the red lines are on this crude example.

enter image description here

2

I stand corrected! A far better solution (thanks to @iant for the suggestion).

  • have three grids.
  • primary grid is your standard grid, solid format, no labels. This just gives the lines.
  • secondary grid is 'frame and annotations only' and uses a custom format for labels. This is offset by (say) 500 meters in both x and y axes. It should use the same interval as the primary grid. This will show eastings
  • tertiary grid. Same settings as secondary grid. This will show northings.
  • make sure you set the crs to 27700 for all grids.

Here I'm using OSGB. In my case, I'm using an interval of 5000, and an offset of 500 for the secondary and tertiary grids.

On the secondary grid, the custom format needs to be something like

(@grid_number - offset)

where offset is how far you offset the second grid from the first. This makes sure the label matches up with the primary grid

example. Have kept labels of primary layer on, but outside frame, so you can see it works. Black is the primary grid, blue the secondary grid (eastings). Also added a third grid (yellow) for northings.

enter image description here

Note that the grid offset can't be set to negative (in the GUI at least), so if you need the label appear to the left, subtract the offset from the primary grid interval, and use that as the offset. You'll need to adjust the offset in the formula above so the label match up with the primary grid...

  • ah very clever thanks for this, hopefully they will implement an option to allow for this. – Aaron Llewellyn Wade Evans Mar 26 '17 at 10:49
1

I don't think this is possible (as of 2.18.3)

You've probably tried the x and y offset options, but these nudge the whole grid, not the labels.

I tried a creative hack, by using a custom label expression and putting in newlines into the labels, but with no luck ... they render as 'unknown symbols' in every font I've tried

'\n' || '\n' || @grid_number

Your best bet is probably

  • have an unlabelled grid
  • create a regular grid of points, with the same spacing as your grid, but whose locations are offset relative to your actual grid, and
  • label those points (turn off symbols, but keep labels on)

See this answer for how to go around that. You're using OS GB National Grid so that should be less painful than if you wanted degrees/minutes/seconds.

  • 2
    How about 2 grids and an offset, one for the lines and one for the number – Ian Turton Mar 24 '17 at 19:34
  • good idea! i think that might work - but would need to add the offset onto @grid_number to make sure it was the grid value, not the label position – Steven Kay Mar 24 '17 at 20:33

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.