Joining shapefiles is a relatively straightforward proess in QGIS using 'add vector join' in the layer properties menu. I can add a csv file as a vector layer, as well as a shapefile, and join the two using a common field.

I would like to do a similar join using PyQGIS. However, I can't seem to find any documentation on how to go about this.

Is this possible to do programmatically using PyQGIS with 'add vector join' or the older 'Join by Attributes'?


1 Answer 1


You can find working code for attribute joins in the source of processing JoinAttributes.py: https://github.com/rldhont/Quantum-GIS/blob/master/python/plugins/processing/algs/qgis/JoinAttributes.py ... basically, you loop over both layers and compare manually.

  • 1
    The URL you provided is not available anymore...
    – Taras
    Commented Dec 2, 2021 at 12:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.