I'm trying to create my first script with qgis. I began with graphical modeler but some bugs block me to do calculation on variables. So I decide to write it myself.

I wrote that for the moment :

##sortie=output vector

demilargeur = (largeur)/2

angleinverse = -(angle)

reproj_1 = processing.runalg('qgis:reprojectlayer', point, 'EPSG:2154', None, progress=None)

enveloppe = processing.runalg('qgis:concavehull', reproj_1['OUTPUT'], 0.1, False, False, None, progress=None)

rotate1 = processing.runalg('grass7:v.transform', enveloppe['OUTPUT'],0.0,0.0,0.0,1.0,1.0,1.0, angle, None,-1.0,0.0001,0,None, progress=None)

buffer = processing.runalg('qgis:fixeddistancebuffer', rotate1['OUTPUT'], demilargeur, 12, False, sortie)

But I have this message :

2017-09-05T16:42:11 1 Erreur : valeur du paramètre faux : None

2017-09-05T16:42:11 2 Uncaught error while executing algorithm

Traceback (most recent call last): File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/GeoAlgorithm.py", line 203, in execute self.processAlgorithm(progress)

File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/script/ScriptAlgorithm.py", line 378, in processAlgorithm exec((script), ns)

File "", line 21, in TypeError: 'NoneType' object has no attribute 'getitem'

I think issue come from v.transform treatment, because I made a test without it and it run well. I searched for information about writting v.transform in qgis script but I didn't find nothing...

Somebody have an idea to help me ?

  • 1
    Probably due to the extent parameter for v.transform which requires you to set an extent instead of leaving it as None. Check this post to see how to define the extent and try include this into the parameter: Getting layer extent in PyQGIS?
    – Joseph
    Commented Sep 5, 2017 at 14:59
  • I tried to put 2 lines to have extent but it returns me iface is not defined...
    – Tim C.
    Commented Sep 5, 2017 at 15:14
  • 1
    You will need to use from qgis.utils import iface :)
    – Joseph
    Commented Sep 5, 2017 at 15:16
  • Ok, but I've a new error :D 'NoneType' object has no attribut 'extent'. I put the 2 lines for extent between concave hull and v.transform treatment.
    – Tim C.
    Commented Sep 6, 2017 at 9:09
  • 1
    I found something who works : layer = processing.getObject(enveloppe['OUTPUT']) ext = "%f,%f,%f,%f" %(layer.extent().xMinimum(), layer.extent().xMaximum(), layer.extent().yMinimum(), layer.extent().yMaximum())
    – Tim C.
    Commented Sep 6, 2017 at 13:02

1 Answer 1


I found solution with Joseph help. v.transform need an extent as parameter just after angle. So to have extent, just 2 lines :

layer = processing.getObject(your_vector_layer) #for me enveloppe['OUTPUT']
ext = "%f,%f,%f,%f" %(layer.extent().xMinimum(), layer.extent().xMaximum(), layer.extent().yMinimum(), layer.extent().yMaximum())

Put ext instead of extent parameter. It works with others treatment like vector grid or any treatment who need an extent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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