Auto-Generate a Print-Ready A4 Map Layout in QGIS

QGIStutorialmap layoutcartographydrone mappingaerial surveyPython
Auto-Generate a Print-Ready A4 Map Layout in QGIS

Setting up a QGIS print layout manually — adding a map frame, scale bar, north arrow, legend, and title — takes several minutes even for experienced users. This script does the whole thing in one run and opens the Layout Designer so you can tweak before exporting.

Here’s a real export from a forest estate survey — script-generated map frame, scale bar, north arrow, and legend, with the auto-generated date title renamed and the legend entries relabelled in Layout Designer before export:

Print-ready A4 map layout of a forest estate, showing boundary, drone take-off point, roads/paths, and walked boundary, with title, legend, scale bar, and north arrow

What it does

The create_map_layout.py script creates an A4 map layout from whatever is visible in the current QGIS canvas view. It automatically adds:

  • Map frame — the current canvas extent
  • Scale bar — metres, positioned at the bottom of the page
  • North arrow — top-right corner
  • Date title — today’s date as the map title
  • Legend — all visible vector layers with their current symbology

Once generated, the layout opens in the QGIS Layout Designer where you can make final adjustments before exporting to PDF or image.

What you need

  • QGIS 3.28 or newer
  • Layers loaded and styled in QGIS — the script captures the current canvas view
  • The create_map_layout.py script from the GIS Utilities Pack

Steps

  1. Open QGIS and style your layers the way you want them to appear on the map.
  2. Pan and zoom the canvas to the extent you want to print.
  3. Open Plugins → Python Console → Show Editor.
  4. Paste the script. Find the ORIENTATION variable near the top and set it to 'portrait' or 'landscape' (default: 'landscape').
  5. Click Run. The layout opens in the Layout Designer.
  6. Make any final adjustments and export via Layout → Export as PDF.

Tips

  • Legend entries — only checked (visible) vector layers appear in the legend. Hide layers you don’t want included before running.
  • Title — the script uses today’s date as the title. Rename it in Layout Designer if you need a custom title.
  • Scale bar units — set to metres. For large-scale maps covering hundreds of kilometres, change the unit in the scale bar properties.

This script is usually the last step, after your layers already have the styling you want. classify_layer.py is a common one to run first if you want a graduated colour classification to show up in the legend.

Get the script

create_map_layout.py is part of the GIS Utilities Pack — four everyday QGIS automation scripts for $25 USD.