Lesson 11.2Lesson 11.2 · Professional Practice & Capstone
Automation: PyQGIS, arcpy & Model Builders
Do it once by hand, twice by model, forty times by script
You have to buffer, clip and count amenities for forty wards by Friday.
The analysis for one ward is easy: buffer the bus stops by 400 metres, clip to the ward, count the households inside. Twelve clicks. Now do it forty times. By ward twelve your attention drifts; by ward thirty you have used the wrong buffer distance twice and cannot remember which. Repetition is where GIS quietly goes wrong - not through hard analysis, but through a human doing an easy thing too many times. Automation is not about being clever; it is about being consistent.
The computer is a patient intern who never mistypes the buffer distance on ward thirty.
Start visual: the model builder you already have
You do not begin automation by writing code. You begin by drawing the workflow. Both major tools ship a visual builder - the QGIS Graphical Modeler (also called the Model Designer) and ArcGIS ModelBuilder - where you drag the tools you already know onto a canvas and wire them together: an input dataset feeds a Buffer, whose output feeds a Clip, whose output feeds a summary. You set the parameters once. Save it, and the model becomes a new tool of your own: point it at a different ward, press run, and the whole chain executes exactly as before.
This is the single highest-value habit in this lesson, because it captures the two things repetition threatens - the steps and the parameters - in a form that cannot drift. A model is also documentation: six months later it shows you, and anyone who inherits your project, precisely what was done.
A model is a recipe. A screenshot of your menus is a photo of a meal.
Then batch: the same rule over many datasets
A model runs a chain once. The next need is to run it over many inputs - forty wards, twelve cities, every GeoTIFF in a folder. Both builders offer a batch or iterator mode for exactly this, and it is where the day-long task collapses to a minute of supervised computer time.
The mental shift is from noun to loop: instead of "buffer this ward," you say "for every ward, buffer it." You describe the operation once and the list it should walk. The computer never gets bored on ward thirty, never fat-fingers the distance, and produces forty outputs named by a rule rather than by whatever you happened to type. Consistency, not speed, is the real prize - though the speed is nice.
Reach for Python when the model runs out of room
Visual models cover a great deal, but they strain at conditionals ("only clip if the layer has features"), at custom maths, and at gluing GIS to the rest of your work. That is when a short script earns its place. PyQGIS is the Python interface that drives QGIS; arcpy is the equivalent that drives ArcGIS Pro. In both, the tools you know from the menus become one-line function calls, and an ordinary for loop does your batch. A useful, quietly reassuring fact: in ArcGIS Pro you can build a workflow in ModelBuilder and export it to a Python script, so your first arcpy is often written for you.
Not every task needs the whole GIS running, though. geopandas handles vector data as a familiar table you can filter, join and buffer in a few lines; rasterio does the same for raster grids. Both sit on GDAL/OGR (version 3.13.2), the read/write engine underneath nearly every GIS tool there is - which is why a geopandas script and a QGIS click often give byte-for-byte the same answer. You learn the layer of the stack your task needs; the engine below is shared.
You are not "learning to code." You are writing the sentence "do this to each of these."
The real payoff: reproducibility
Speed is the reason people try automation; reproducibility is the reason they keep it. A saved model or a short script is an exact, re-runnable record of your analysis. When the data updates - a new census, a corrected land-use layer - you press run rather than remembering. When a reviewer, a court, or your future self asks how did you get this map?, the answer is a file, not a memory. When you find a mistake, you fix it in one place and regenerate everything downstream.
This is also honesty made practical. Module 11's later lessons ask you to document lineage and data quality; an automated pipeline is lineage - it states, in runnable form, exactly what was done to the data. A studio that automates is a studio whose claims can be checked.
When NOT to automate
Automation has a cost - the time to build the model or write the script - so it pays only when the work repeats or must be trusted. A genuinely one-off exploration of a single site is faster by hand; forcing it into a script is its own kind of waste. The rule of thumb: if you will do it more than about three times, if more than one person must run it the same way, or if the result must be defensible later, automate. Otherwise, click, and move on. Automation is a servant, not a virtue.
QGIS Graphical Modeler / ArcGIS ModelBuilder
Visual, no-code workflow builders inside each GIS
The first rung: capture steps and parameters as a re-runnable graph; ModelBuilder can export to Python.
PyQGIS / arcpy
Python APIs that drive QGIS and ArcGIS Pro respectively
Menu tools become one-line calls; a for-loop does your batch. arcpy ships with ArcGIS (paid); PyQGIS is free.
geopandas + rasterio
Python libraries for vector (geopandas) and raster (rasterio) analysis outside a full GIS
Free and open-source; treat vector data as a table and rasters as arrays in a few lines.
GDAL/OGR 3.13.2
The raster (GDAL) and vector (OGR) translation/processing engine under most GIS
Why a scripted result and a clicked result usually match - both call the same engine.
Workshop - build a model once, run it over many wards
Capture a small three-step analysis as a visual model, run it on one ward to prove it, then batch it over several. Optionally, export or write the equivalent as a few lines of Python.
QGIS 3.44 Graphical Modeler + optional PyQGIS/geopandas (free), or ArcGIS Pro 3.7 ModelBuilder + optional arcpy. Free OSM/Census-derived layers.
Given: a ward-boundaries layer + a bus-stops (points) layer for one Indian city Goal: for each ward, the count of households (or area) within 400 m of a stop, produced by one re-runnable model Time: ~60 minutes
- 1Open the visual builder. In QGIS: Processing > Graphical Modeler. In ArcGIS Pro: Analysis > ModelBuilder. Add the ward layer and the stops layer as model inputs.
- 2Wire three tools you already know: Buffer the stops (400 m), Clip/Intersect with a ward, then a summary (count or area). In QGIS these come from the Processing toolbox; in ArcGIS from the Tools gallery. Set parameters once and save the model as your own tool.
- 3Run it on a single ward to confirm the numbers look right. Fix any wiring, then save again - this is now documentation of exactly what you did.
- 4Batch it. In QGIS: run the model from the toolbox and click the Run as Batch Process button, feeding the list of wards. In ArcGIS: add an Iterator (Iterate Feature Selection) to the model, or export the model to Python via Model > Export > To Python Script.
- 5Optional Python rung: reproduce one step in code. In PyQGIS or with geopandas, a few lines read the layers, buffer, and loop over wards; run it and confirm you get the same counts the model produced.
You’ll walk away with
A saved model (QGIS or ArcGIS) that computes the metric for any ward, a batch run producing one result per ward, and - if you took the last step - a short script that reproduces it.
Three altitudes on the same idea
Read the band that fits you — or all three.
Automate the analysis, not the design. The judgement of where a building sits stays yours; what a model saves you is the repetitive site-context work - buffers, slope classes, view catchments - across options or across a portfolio of plots. Build one suitability model and you can test three sites this afternoon instead of one, each measured identically.
Your datasets are inherently batch. Land-use checks, ward-by-ward accessibility, buffer-based zoning compliance - these are the same operation over hundreds of features, the exact case model builders and PyQGIS/arcpy were made for. Automating them also gives you an auditable pipeline, which matters when a statutory plan must show how a number was derived.
Repeatable metrics let you compare places fairly. A script that computes junction density, block size and walkable catchment can be run across every neighbourhood in a study, so your comparison is honest rather than dependent on which areas you had energy to measure by hand. Change the definition once, re-run everywhere.
“Automation means learning to program, which is a separate career I do not have time for.”
Do it yourself
No software - just think in loops and steps.
- 1Rewrite this as a loop: "buffer ward A, buffer ward B, buffer ward C ... buffer ward Z."
- 2You have done a five-step analysis by hand for one site and will never repeat it. Automate, or not? Why?
- 3Name one thing a visual model captures that a screenshot of your menus does not.
- 4Which library would you reach for to buffer polygons without opening a GIS at all - rasterio or geopandas?
- 5Explain how an automated pipeline doubles as a record of data lineage.
The one line to carry out
Peer-reviewed journals & authoritative standards
- 01de Smith, M.J., Goodchild, M.F. & Longley, P.A. — Geospatial Analysis: A Comprehensive Guide, 7th ed. — Winchelsea Press, 2025.
- 02Longley, P.A., Goodchild, M.F., Maguire, D.J. & Rhind, D.W. — Geographic Information Science and Systems, 4th ed. — Wiley, 2015.
- 03Chang, K.-T. — Introduction to Geographic Information Systems, 9th ed. — McGraw-Hill Education, 2019.
- 04Transactions in GIS — Wiley, ongoing.
- 05International Journal of Geographical Information Science (IJGIS) — Taylor & Francis, ongoing.
An automated pipeline is a record of what you did to the data; the next lesson asks the harder questions of what the data is, how good it is, and who is allowed to use it - metadata, standards and policy.
The author
Amogh N P
Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.
More about Amogh →