5

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'?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Krausers
  • 544
  • 1
  • 7
  • 15

1 Answers1

4

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.

MasterPJ
  • 359
  • 1
  • 3
  • 12
underdark
  • 84,148
  • 21
  • 231
  • 413