Studio Matrx Monthly · Volume 1 · Issue 3 · August 2026
Amogh N P
 In loving memory of Amogh N P — Architect · Designer · Visionary 
Automation: PyQGIS, arcpy & Model BuildersLesson 11.2
GIS for Architecture, Planning & Urban Design/Module 11 · Professional Practice & Capstone

Lesson 11.2 · Professional Practice & Capstone

Automation: PyQGIS, arcpy & Model Builders

Do it once by hand, twice by model, forty times by script

13 min Interactive lessonFree · open lessonByAmogh N P· Architect & interior designer
The hook

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 saved workflow input plots Buffer 250 m Clip to ward output catchment Change the input, press run, get a fresh output. Every time. Identically. QGIS Graphical Modeler and ArcGIS ModelBuilder both draw this
Zoom
A visual model wires inputs to tools to outputs; saved once, it re-runs the whole chain on any dataset.

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.

One rule, forty datasets 40 wards ward_01..40 for ward in wards: Buffer(ward, 250) 40 outputs buffered PyQGIS or arcpy runs the loop; you supervise, you do not click
Zoom
A short script loops one operation over forty wards while you make tea; the clicks that used to take a day take a minute.

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.

The geo-Python stack GDAL / OGR the read / write engine under it all geopandas + rasterio vector and raster analysis in code PyQGIS / arcpy drive the GIS itself your 30-line script learn the layer you need; the engine below is shared
Zoom
The Python geo-stack sits on one engine: GDAL/OGR underneath, analysis libraries above, and your short script on top.

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.

Tools & libraries in this lesson

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.

Hands-on workshop

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 & goal
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
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

The worked example

Three altitudes on the same idea

Read the band that fits you — or all three.

For the architectSite, form & environment

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.

For the plannerLand use, zoning & infrastructure

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.

For the urban designerStreets, blocks & public realm

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.

Misconception check

Automation means learning to program, which is a separate career I do not have time for.

The first and most valuable rung is visual: a QGIS Model or ArcGIS ModelBuilder graph is drawn with the mouse, using tools you already use. When you do reach Python, ArcGIS can export your model to a script for you, and the first PyQGIS or geopandas jobs are a handful of readable lines. You automate the boring part; you do not become a software engineer.
Try it

Do it yourself

No software - just think in loops and steps.

  1. 1Rewrite this as a loop: "buffer ward A, buffer ward B, buffer ward C ... buffer ward Z."
  2. 2You have done a five-step analysis by hand for one site and will never repeat it. Automate, or not? Why?
  3. 3Name one thing a visual model captures that a screenshot of your menus does not.
  4. 4Which library would you reach for to buffer polygons without opening a GIS at all - rasterio or geopandas?
  5. 5Explain how an automated pipeline doubles as a record of data lineage.
Take this with you

The one line to carry out

Do a thing once by hand to understand it, capture it in a model the second time, and let a script loop it the fortieth time. Automation's gift is not speed but consistency and a runnable record of exactly what you did - the foundation of a defensible map.
Take it further
References & further reading

Peer-reviewed journals & authoritative standards

  1. 01de Smith, M.J., Goodchild, M.F. & Longley, P.A. — Geospatial Analysis: A Comprehensive Guide, 7th ed.Winchelsea Press, 2025.
  2. 02Longley, P.A., Goodchild, M.F., Maguire, D.J. & Rhind, D.W. — Geographic Information Science and Systems, 4th ed.Wiley, 2015.
  3. 03Chang, K.-T. — Introduction to Geographic Information Systems, 9th ed.McGraw-Hill Education, 2019.
  4. 04Transactions in GISWiley, ongoing.
  5. 05International Journal of Geographical Information Science (IJGIS)Taylor & Francis, ongoing.
Related lessons
Recap
Automate on three rungs - visual model builders, then batch/iterators, then PyQGIS/arcpy or geopandas/rasterio on the shared GDAL/OGR engine - and only when work repeats or must be trusted.
Carry forward →

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.

A

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 →