I would like to replicate the behaviour of the "Join Attributes by Location" function of the Qgis GUI (Vector >> Data Management Tools >> Join Attributes by Location) using a pyQgis script. I attempt this with the following call:
processing.runalg("qgis:joinattributesbylocation",
"path/to/points.shp",
"path/to/polygons.shp",
u'intersects',
0,
0,
'',
1,
"path/to/output.shp")
This works except that the resulting output.shp
does not contain all the fields of points.shp
, it contains only the first two, which happen to be longitude and latitude.
When I use the GUI operation, the resulting output.shp
retains all the fields of points.shp
and polygons.shp
. How do I ensure that all fields of the target vector appear in the output vector?