6

I am trying 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 find a way in QGIS to do that.

5 Answers 5

6

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

0
4

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

2

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.

0
2

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:

Placing elevation numbers on contours with uphill orientation and position in QGIS?

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


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

enter image description here

0
2

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 attribute table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.