QGIS_param

A map for every reader: how to generate hundreds of images for multiple audiences or partners using QGIS and Python

The BBC Shared Data Unit wanted to generate a map image for each authority in the UK showing the state of flood defences in that area — so they turned to the mapping tool QGIS’s built-in Python functionality.

This repo contains files and tipsheets for learning how to generate and export dozens of maps in QGIS centred at different points, and how AI can help speed up the process.

This process is sometimes called parameterisation: generating multiple outputs based on a list of parameters (e.g. a list of lat-long locations).

The slides going through the process are here

Prerequisites and tools

You should have some basic knowledge of QGIS and be comfortable using Python or vibe coding.

You should have QGIS and Python installed on the computer and a free account with an AI tool such as ChatGPT, Gemini or Claude.

Objectives

After using this repo you should be able to understand how Python works in QGIS and use AI to help generate, understand and adapt code

Files

You will need the following files:

  1. A shape file of some sort, to create a map with. The example used is AIMS_Spatial_Flood_Defences_inc_standardised_attributes.shp.zip from the Spatial Information section of AIMS Spatial Flood Defences (inc. standardised attributes)
  2. A list of lat-longs for the places you want to generate map images for
  3. A Python file containing the code to automate multiple image exports

Walkthrough steps

  1. 01_make_a_map.md describes how to create a basic map in QGIS
  2. 02_layout.md describes how to create a Layout in QGIS for exporting an image
  3. 03_qgis_python.md describes how to use a Python file to automate map image exports
  4. Turning a table into a list in Excel describes how to generate a Python list of lat-longs and city names if you don’t already have one. You could also use AI to do this.
  5. 04_AI_prompt.md provides a template prompt for using AI to ‘vibe code’ while addressing the risks of deskilling

Kuang Keng’s workshop on making a map publication-ready has some additional tips on customising your map further.

Optional files

You can use the following files to practise the processes above, and expand them: