I try to use qgis to create a custom topographic map for outdoor use: UTM, 1:50000.

What these maps usually have is a 1km x 1km grid, which at the bottom is labeled with a shorthand for the corresponding UTM grid coordinate:

Say the UTM easting of a vertical line is 05532000, then I'd label the line with 32. The 055 is redundant because every line in the map will have that part (provided the map doesn't cover too large an area), and the 000 is redundant as the grid lines are placed at multiples of 1000.

Now, I used qgis to create the grid, and I added a column to the corresponding data file containing the labels I'm after, but when I use the "Display labels" functionality in the properties of the shapefile, the labels occur in the center lines of the map, whereas I'd like to have them at the margin. I didn't really find a way in qgis to do that and would appreciate any help.

(If other open source software is better suited to create nice topographic maps from a GeoTIFF file, I'd also appreciate that, as long as it runs on Linux or Mac)


From QGIS 2.12 this will be possible using "custom" grid annotation format. enter image description here

  • To simplify my expression, use: left( right( @grid_number, 5), 2) Jul 23 '17 at 8:24

There have been recent advancements to grids in QGIS. Two are PyQGIS plugins, the other a C++ map canvas decoration. While I don't think any of them will truncate the labels like you wish, they are all open source and GPL licensed.

You could edit one of these to add your features of reducing label text redundancy and centering of the label. The authors of tools would probably appreciate useful changes and might accept your edits to be included in a future release.

Grid Decoration

This is very new C++ decoration accessible via the View-> Decorations menu. It is currently only available in the master branch of QGIS, so you'll have to compile QGIS yourself (Mac), or use one of nightly build repositories for Linux.

enter image description here

Grid Overlay Plugin

This plugin, built by MerseyViking, is also very new. So new, it's not in a plugin repository yet and is still in an alpha state (as of July 5, 2012). You can download an archive from its github.com repository and manually install the plugin. It creates a plugin layer that provides a grid in the map units of your project. After creating the grid, you can double-click the plugin layer to edit its parameters. It has excellent label configurations, and is probably the best candidate for editing-in your features.

enter image description here

Grids for Atlas Plugin

This plugin can be installed via the official repository (QGIS 1.8.0) via the Plugin Installer (see repository listing). It creates static and dynamic grids relative to the coverages used by the Atlas plugin. I don't think it provides labels, but might be coded to do so. It offers the advantage of integration with map book creation.

enter image description here


In the Map Composer, you can display a grid. It is available in the Item Properties tab (when the map canvas is the focus) and the sub-tab is Grid. Show the grid and click on Draw Annotation. You can experiment with the coordinate precision setting to manipulate the label.

  • Not quite what we're looking for Willy. I'll add a picture to my answer above. Nick.
    – nhopton
    Jul 5 '12 at 11:25
  • It's almost what I'm looking for. The position is correct, but I'd like more control over the format
    – Lagerbaer
    Jul 5 '12 at 17:58
  • Of course, an option would be to have a look at the source code and put it in the composer dialog :)
    – Lagerbaer
    Jul 6 '12 at 5:21
  • Hope it helped. I note that I am a believer in presenting the full UTM coord with the zone as a label on the final map....
    – Willy
    Jul 7 '12 at 13:03

I don't think there is a way of doing what you want, or if there is I don't know how to do it. Just at the moment I'm making eight maps that need this form of grid labelling and I'm having to add each grid ordinate as a label. It's taking me hours.

It should be possible to exercise some control on where grid ordinate labels appear on the map, using a variant of this method:

How to place elevation numbers on contours with uphill orientation and position?

but of course this won't put the labels in the margins where they belong.

Regards, Nick.

Added later: the question is about labelling grids as shown in the picture (I think!).

enter image description here

  • Your picture shows exactly what I want. Right now I used the composer to make a grid, but there you don't have control over the labels, they always give the full easting/norting, not just the "middle" two digits
    – Lagerbaer
    Jul 5 '12 at 17:58

The new labeling engine in QGIS offers the possibility to place each label at a specific X-Y location. You need to add two new columns to the attrib table, say label_x, label_y. THen in the "Data Defined Settings" in the Labeling window, choose those two columns for "X coordinate" and "Y coordinate" respectively. Now you should be able (with editing enabled on the grid layer) to move each of the labels individually from the center of the grid lines to it's position around the edges of the map. The new locations will be saved in the attrib table.

Tiresome, but it should work... HTH

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.