Outdated version of the documentation. Find the latest one here.

5.1. Lesson: Using Map Composer

Now that you’ve got a map, you need to be able to print it or to export it to a document. The reason is, a GIS map file is not an image. Rather, it saves the state of the GIS program, with references to all the layers, their labels, colors, etc. So for someone who doesn’t have the data or the same GIS program (such as QGIS), the map file will be useless. Luckily, QGIS can export its map file to a format that anyone’s computer can read, as well as printing out the map if you have a printer connected. Both exporting and printing is handled via the Map Composer.

The goal for this lesson: To use the QGIS Map Composer to create a basic map with all the required settings.

5.1.1. basic Follow Along: The Composer Manager

QGIS allows you to create multiple maps using the same map file. For this reason, it has a tool called the Composer Manager.

  • Click on the Project ‣ Composer Manager menu entry to open this tool. You’ll see a blank Composer manager dialog appear.
  • Click the Add button and give the new composer the name of Swellendam.
  • Click OK.
  • Click the Show button.

(You could also close the dialog and navigate to a composer via the File ‣ Print Composers menus, as in the image below.)

../../../_images/print_composer_menu.png

Whichever route you take to get there, you will now see the Print Composer window:

../../../_images/print_composer_dialog.png

5.1.2. basic Follow Along: Basic Map Composition

In this example, the composition was already the way we wanted it. Ensure that yours is as well.

  • In the Print Composer window, check that the values under Composition ‣ Paper and Quality are set to the following:
  • Size: A4 (210x297mm)
  • Orientation: Landscape
  • Quality: 300dpi

Now you’ve got the page layout the way you wanted it, but this page is still blank. It clearly lacks a map. Let’s fix that!

  • Click on the Add New Map button: addMap

With this tool activated, you’ll be able to place a map on the page.

  • Click and drag a box on the blank page:
../../../_images/drag_add_map.png

The map will appear on the page.

  • Move the map by clicking and dragging it around:
../../../_images/move_map.png
  • Resize it by clicking and dragging the boxes in the corners:
../../../_images/resize_map.png

Bemerkung

Your map may look a lot different, of course! This depends on how your own project is set up. But not to worry! These instructions are general, so they will work the same regardless of what the map itself looks like.

  • Be sure to leave margins along the edges, and a space along the top for the title.

  • Zoom in and out on the page (but not the map!) by using these buttons:

    zoomFullExtent zoomIn zoomOut

  • Zoom and pan the map in the main QGIS window. You can also pan the map using the Move item content tool: moveItemContent

When zooming in, the map view will not refresh by itself. This is so that it doesn’t waste your time redrawing the map while you’re zooming the page to where you want it, but it also means that if you zoom in or out, the map will be at the wrong resolution and will look ugly or unreadable.

  • Force the map to refresh by clicking this button:
../../../_images/refresh_button.png

Remember that the size and position you’ve given the map doesn’t need to be final. You can always come back and change it later if you’re not satisfied. For now, you need to ensure that you’ve saved your work on this map. Because a Composer in QGIS is part of the main map file, you’ll need to save your main project. Go to the main QGIS window (the one with the Layers list and all the other familiar elements you were working with before), and save your project from there as usual.

5.1.3. basic Follow Along: Adding a Title

Now your map is looking good on the page, but your readers/users are not being told what’s going on yet. They need some context, which is what you’ll provide for them by adding map elements. First, let’s add a title.

  • Click on this button: label
  • Click on the page, above the map, and a label will appear at the top of the map.
  • Resize it and place it in the top center of the page. It can be resized and moved in the same way that you resized and moved the map.

As you move the title, you’ll notice that guidelines appear to help you position the title in the center of the page.

However, there is also a tool to help position the title relative to the map (not the page):

alignLeft

  • Click the map to select it.
  • Hold in shift on your keyboard and click on the label so that both the map and the label are selected.
  • Look for the Align button alignLeft and click on the dropdown arrow next to it to reveal the positioning options and click Align center:
../../../_images/align_center_dropdown.png

To make sure that you don’t accidentally move these elements around now that you’ve aligned them:

  • Right-click on both the map and the label.

A small lock icon will appear in the corner to tell you that an element can’t be dragged right now. You can always right-click on an element again to unlock it, though.

Now the label is centered to the map, but not the contents. To center the contents of the label:

  • Select the label by clicking on it.
  • Click on the Item Properties tab in the side panel of the Composer window.
  • Change the text of the label to “Swellendam”:
  • Use this interface to set the font and alignment options:
../../../_images/title_font_alignment.png
  • Choose a large but sensible font (the example will use the default font with a size of 36) and set the Horizontal Alignment to Center.

You can also change the font color, but it’s probably best to keep it black as per the default.

The default setting is not to add a frame to the title’s text box. However, if you wish to add a frame, you can do so:

  • In the Item Properties tab, scroll down until you see the Frame option.
  • Click the Frame checkbox to enable the frame. You can also change the frame’s color and width.

In this example, we won’t enable the frame, so here is our page so far:

../../../_images/page_so_far.png

5.1.4. basic Follow Along: Adding a Legend

The map reader also needs to be able to see what various things on the map actually mean. In some cases, like the place names, this is quite obvious. In other cases, it’s more difficult to guess, like the colors of the farms. Let’s add a new legend.

  • Click on this button: addLegend
  • Click on the page to place the legend, and move it to where you want it:
../../../_images/legend_added.png

5.1.5. moderate Follow Along: Customizing Legend Items

Not everything on the legend is necessary, so let’s remove some unwanted items.

  • In the Item Properties tab, you’ll find the Legend items panel.
  • Select the buildings entry.
  • Delete it from the legend by clicking the minus button: signMinus

You can also rename items.

  • Select a layer from the same list.
  • Click the Edit button: edit
  • Rename the layers to Places, Roads and Streets, Surafce Water, and Rivers.
  • Set landuse to Hidden, then click the down arrow and edit each category to name them on the legend. You can also reorder the items:
../../../_images/categories_reordered.png

As the legend will likely be widened by the new layer names, you may wish to move and resize the legend and or map. This is the result:

../../../_images/map_composer_result.png

5.1.6. basic Follow Along: Exporting Your Map

Bemerkung

Did you remember to save your work often?

Finally the map is ready for export! You’ll see the export buttons near the top left corner of the Composer window:

filePrint saveMapAsImage saveAsSVG saveAsPDF

The button on the left is the Print button, which interfaces with a printer. Since the printer options will differ depending on the model of printer that you’re working with, it’s probably better to consult the printer manual or a general guide to printing for more information on this topic.

The other three buttons allow you to export the map page to a file. There are three export formats to choose from:

  • Export as Image
  • Export as SVG
  • Export as PDF

Exporting as an image will give you a selection of various common image formats to choose from. This is probably the simplest option, but the image it creates is “dead” and difficult to edit.

The other two options are more common.

If you’re sending the map to a cartographer (who may want to edit the map for publication), it’s best to export as an SVG. SVG stands for “Scalable Vector Graphic”, and can be imported to programs like Inkscape or other vector image editing software.

If you need to send the map to a client, it’s most common to use a PDF, because it’s easier to set up printing options for a PDF. Some cartographers may prefer PDF as well, if they have a program that allows them to import and edit this format.

For our purposes, we’re going to use PDF.

  • Click the Export as PDF button: saveAsPDF
  • Choose a save location and a file name as usual.
  • Click Save.

5.1.7. In Conclusion

  • Close the Composer window.
  • Save your map.
  • Find your exported PDF using your operating system’s file manager.
  • Open it.
  • Bask in its glory.

Congratulations on your first completed QGIS map project!

5.1.8. What’s Next?

On the next page, you will be given an assignment to complete. This will allow you to practice the techniques you have learned so far.