QGIS Script · Python
A4 Map Layout Generator
Auto-generates an A4 map layout from the current QGIS canvas view — complete with scale bar, north arrow, date title, and legend. Opens directly in the Layout Designer so you can make final adjustments before PDF export.
What you get
create_map_layout.pyWhat it does
Auto scale bar and north arrow
Adds a metric scale bar and north arrow automatically — positioned and sized to fit the page without manual adjustment.
Legend from visible layers
Builds a legend from all currently visible vector layers and their symbology. Hide layers you do not want before running.
Portrait or landscape
Set ORIENTATION to "portrait" or "landscape" at the top of the script. Default is landscape.
Opens in Layout Designer
The layout opens in the QGIS Layout Designer immediately so you can rename the title, reposition elements, or export to PDF.
How to use it
- 1
Style your layers and pan/zoom the QGIS canvas to the extent you want to print.
- 2
Hide any layers you do not want in the legend.
- 3
Open Plugins → Python Console → Show Editor.
- 4
Paste the script. Set
ORIENTATIONnear the top to"portrait"or"landscape". - 5
Click Run. The layout opens in the Layout Designer.
- 6
Export via Layout → Export as PDF.
Requirements
- QGIS 3.28 or newer
- No additional packages needed — uses QGIS layout APIs
- Layers styled and visible in the canvas as desired
Also in the GIS Utilities Pack
Get all 4 GIS utility scripts for $25 — save $5 vs buying individually.