In a standalone outside script for QGIS 2.18, i have a layer which contain multiple features to bufferize :

vlayer = QgsVectorLayer(out_dir + "selected_shape.shp", "blabla", "ogr")

I try to run processing for each features

from qgis.core import *
from processing.core.Processing import Processing
from processing.tools import *
import processing

buff_res = processing.runalg("qgis:fixeddistancebuffer", vlayer, 0.2, 99, False, None,)

get_output= processing.getObject(buff_res['OUTPUT'])

for f in get_output.getFeatures():
    print f.attributes()

The qgis:fixeddistancebuffer compute the buffer only on the first feature from my layer. How can i compute the buffer on each feature on this vlayer ?

  • Do you need to apply different buffers for each feature?
    – mgri
    Commented Dec 6, 2016 at 13:16
  • Nop, same buffer for each feature :)
    – reyman64
    Commented Dec 6, 2016 at 13:29

1 Answer 1


If I directly use your code to a sample polygonal layer:

enter image description here

it seems to works:

enter image description here

The Fixed distance buffer algorithm from Processing iterates, by default, over each feature of your layer. There is something more that I don't understand?

  • Using standalone script or directly into QGIS ? Because using Qgis yes, it works, but not with the python script ...
    – reyman64
    Commented Dec 6, 2016 at 14:59
  • What do you intend with "python script"? A script runned inside or outside QGIS? I tested your code creating a new script under the Tools group in the Script algorithms block of the Processing Toolbox...
    – mgri
    Commented Dec 6, 2016 at 15:09
  • Yes, a standalone outside QGIS script
    – reyman64
    Commented Dec 6, 2016 at 15:23

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