Skip to content
Study / Practical
Map layouts in QGIS: from template to automated map series
A series that applies the Map Design notes. Part B builds one finished map of Bengaluru by hand in ten short pages: the project and the page, the map frame, titles and legend, scale bar and grid, a locator map, expressions, templates, several maps on a page, Atlas and export. Part C then automates the same map with Python, and ends with a project that makes a whole map series.
18 partsQGIS 3.44 LTRPyQGISFree software
Part B: Build a layout by hand
10 parts- 01Prepare the project and open a Print LayoutGet a QGIS project ready for a finished map, open a new Print Layout, learn what each part of the layout window does, and set the page size and orientation before you place anything on it.
- 02Add and control the map framePlace a map on the page, set its scale and position exactly, choose which layers it draws so that it no longer changes with the canvas, add a frame, and give the map an ID.
- 03Titles, a source note and a curated legendAdd a title, a subtitle and a source note with a clear order of size, then turn the automatic legend into one that explains the map and nothing else.
- 04Scale bar, north arrow and coordinate gridAdd a scale bar that is linked to the map, a north arrow that follows the map, and a coordinate grid with labels on two sides, and learn when each one earns its place.
- 05A locator map with an overview frameAdd a second map that shows where the main map sits inside Karnataka, mark the main map's footprint on it with an overview frame, and label it so that a reader who does not know Bengaluru can place it.
- 06Expressions and data-defined propertiesPut live values into layout text with expressions, and use the data-defined override button to let a formula or a variable control a layout setting, such as whether a draft stamp is exported.
- 07Save and reuse a layout templateSave the finished layout as a .qpt template, make a new layout from it, and learn what a template keeps, what it leaves out, and how to test it in a fresh project.
- 08A page with several mapsPlace two maps side by side at the same scale and extent, give each its own layers with a map theme, and give each its own legend, so that a reader can compare two measures of the same places.
- 09Atlas: a map for every featureTurn the finished layout into a map series with the QGIS Atlas: one page for each corporation, with its own title, its own extent, its own outline and a scale bar that adapts, all from one layout.
- 10Export, reopen and checkExport the finished layout as a PDF and as images, choose a resolution that suits the use, and then reopen the files and check them properly, because the preview in the layout window is not the result.
Part C: Automate it with Python
8 parts- 11How layout automation worksUnderstand what it means to automate a QGIS layout, the five jobs a script does, and the difference between creating a layout, adding items to it and registering it in the project, with a short first session in the Python Console.
- 12Your first layout scriptWrite a script that creates a layout, sets the page to A4 landscape, adds a map frame with chosen layers and an extent, registers the layout and exports a PDF, with every line explained.
- 13Add a title, legend, scale bar and source noteExtend the layout from the first script with a title, a subtitle, a source note, a curated legend and a scale bar, using a small helper function, and make the text come from variables so that the same code can serve any area.
- 14Reuse a layout template with PyQGISLoad a .qpt template into a new layout from Python, find its items by ID, check that they are all there, change the title and the extent, and export, so that the design stays in the template and the script only fills it in.
- 15A map for every feature, with a loopUse a loop to make one map for each city corporation: check the layer first, convert each extent to the map's coordinate system, give every map a fresh copy of the template, and write one PDF with a safe file name for each.
- 16Export and check the outputsExport a layout as a PDF and as a PNG at a chosen resolution, check the layout before the export and the files after it, and learn which checks a script can do and which only a person can.
- 17A complete pipelinePut the previous lessons together as a pipeline: all the settings in one dictionary, a log file that records every step and failure, small functions for each job, checks for duplicate file names, and a summary at the end.
- 18Automating map layouts with PyQGIS: the full projectBuild one layout template, then let a Python script make a professional map for each of Bengaluru's five city corporations, a combined PDF, and a report, with checks before anything is exported.

