QGIS Tutorials

Creating Maps in QGIS Print Layout Part 2

Credit: Youtube Channel “Statistics Canada”

In this continuation we close the loop on creating a production‑ready map with QGIS Print Layout. We assume you already finished the basic map setup in Part 1 and now want to polish the layout – add a legend, north arrow, scale bar, export in different formats, and finally share your map.

1. Add Map Item to Layout

  1. Open the Print Layout from the main menu Project → New Print Layout… and give your layout a name.
  2. In the layout window click Add Map (the icon with a map frame).
  3. Click and drag on the canvas to draw the map frame. Hold Shift to keep a 2:1 aspect ratio.
  4. Right‑click the map frame, choose Item Properties and set:
    • Resolution (DPI) – 300 dpi for print, 150 dpi for web
    • Extent – Lock it if you don’t want it changing automatically.
    • Frame style – choose None for a cleaner look.
  5. In the Item Properties → Sources pane, select the layers you want visible in this map item. Use the Add to map button to pull layers from your current project.

2. Customize the Map Frame

  • Scale Toolbar – Pinpoint a desired map scale. Use the Zoom to Scale button (Ctrl+Z) and enter a value like 1:10000.
  • Rendering – Toggle Render on the fly if you need temporary styling changes.
  • To preserve the aspect ratio when zooming, hold Alt while dragging the map frame.

3. Add Map Controls

3.1 North Arrow

  • Click Add North Arrow (icon of an arrow).
  • Position it in the corner; resize it by dragging its handles.
  • In Item Properties pick a style from the library or create a custom arrow by editing the SVG file.

3.2 Scale Bar

  • Click Add Scalebar and then click on the layout.
  • Choose Linear or Bar from the style drop‑down.
  • Set the Units (meters, feet, or custom) and Range (e.g., 0 – 100 km).
  • Use the Digits field to control tick label precision.

3.3 Description

  • Use Add Label to insert a call‑out with the map title, subtitle, or legend explanation.
  • Format text with the standard Text Format toolbar – font, size, color, alignment.

4. Insert Legend

  1. Click Add Legend.
  2. Click on the layout to create the legend frame.
  3. In the Legend Items list, drag to reorder layers or disable unwanted layers.
  4. Adjust the Legend Frame properties: border, background color, and padding.

5. Fine‑Tuning Layer Styles

  • Return to the main QGIS window to tweak symbology.
  • Use Map Themes to quickly apply different style presets to your map.
  • After changes, click Refresh in the layout to see updates.

6. Exporting the Map

You can export in several formats suited to your audience:

  • PDF – File → Export Map to PDF. Options:
    • Resolution
    • Compression level
    • Include hidden layers (if desired)
  • SVG – File → Export Map to SVG. Perfect for vector‑based editing later.
  • JPEG/PNG – Choose Export Map as Image. Set DPI, color depth, and export area (full layout or current map frame).
  • For web and online use, consider generating a GeoPackage with embedded map templates and shareable links.

7. Optimizing for Performance

Large vector layers can slow export. To mitigate:

  • Use Render Cache – Settings → Rendering → Enable render cache for faster previews.
  • Pre‑style your layers into class-based symbology that uses categorized or graduated rules.
  • When exporting, uncheck Data Source Layers to avoid unnecessary redraws.

8. Automating Repetitive Tasks

When producing multiple layouts, scripts help:

  • Use Python Console to create a script that loads a QGIS project, opens a layout, updates map extent, and exports PDFs.
  • Example snippet (you can paste into the Python Console):
# Load layout
project = QgsProject.instance()
layout_manager = project.layoutManager()
layout = layout_manager.printLayout("Final_Map")

# Update map item
map_item = layout.pageCollection().itemById("Map1")
item_properties = map_item.itemProperties()
item_properties.setScale(10000)

# Export
pdf_path = "/home/user/Maps/Final_Map.pdf"
layout.exportToPdf(pdf_path, QgsLayoutExporter.PdfExportSettings())

9. Saving and Sharing

  • Save the entire QGIS project (.qgz) so that all layer styles, labels, and layout configurations are bundled.
  • For collaborative work, use QGIS Cloud or Git to version control your QGIS project.
  • When sharing with non‑QGIS users, provide:
    • A high‑resolution PDF for print publications.
    • An interactive PDF (if you embed a PDF map with clickable features).
    • A set of raster images (JPEG) for website graphics.

10. Closing Thoughts

By mastering map items, legends, map controls, and export options, you can transform raw GIS data into polished, publication‑ready maps. The key is iterative refinement: tweak one element, preview, and repeat until the layout tells the spatial story you intend. Happy mapping!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *