4

I have a map grid (line, shp) that was created with MMQGIS. The X and Y coordinates of the lines are stored in the the attribute table, which makes labelling the lines an easy process.

My problem is with the location of the labels. Currently the labels are in the default position, central. This poses an issue when I want to print a gridded map as the labels are very prominent and obscure information in the center of the map.

I wish to align the labels of horizontal lines to the left margin of the page and labels of vertical lines to the top of the page.

I have seen an identical question asked previously here SHP file Left / Right Label Alignment issue in QGIS 2.0.1-Dufour I have attempted to use the same solution with no success. I am using version 2.14.1 and the coding required to position the labels at the start or end of the line must be different, or I am using the code incorrectly.

I have attached an image as an example of the default. I wish to move the labels to the left for the horizontal lines, and to the top for the vertical lines. If it is possible to offset the labels from the edge of the page that would also be great.

If any more information is needed please let me know.

Image 01: Centered labels Centered labels are a problem


Edit 01, for clarification:

I have managed to align the labels to the edge of the lines, although this is at a fixed position (see image).

The problem is that if I zoom in on a specific area I cannot see the labels. I would like the labels to follow the screen boundaries if this is at all possible. (It may not be currently) By doing this, it should hopefully automatically add the labels to the edge of a map created in the print composer.

Image 02: Zoomed out image, labels visible. Edge aligned, zoomed out

Image 03: Zoomed in image, labels in fixed location, therefore not visible. enter image description here

  • 2
    does gis.stackexchange.com/questions/143474/… help? – Ian Turton May 5 '16 at 14:05
  • @iant Yes, this does help although it provides a temporary workaround. This will allow me to print maps with a grid and the appropriate coordinate markers although I am looking to create something similar within the primary QGIS environment and not the print composer. In there I have multiple grid scales with different scale based visibility, the hope is to have each of these display in the manner described above so that I can create an interactive reference where coordinate markers move dynamically. Thanks very much for the link though :) – Robbie Coleman May 5 '16 at 22:48
1

You can use the grid decoration under the view tab to create a semi-dynamic graticule annotation, that, while constant in its scale, updates when you pan the map.

In the following example I've set the grid interval to 1000 meters. There's not much in the design department, but it works.

enter image description here

  • Thank you for this handy tip, this will do well until I'm able to find a way to label my lines similarly. – Robbie Coleman May 17 '16 at 23:26

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.