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 :
##Zonage_alamano=name
##point=vector
##sortie=output vector
##angle=number
##longueur=number
##largeur=number
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 ?
extent
parameter for v.transform which requires you to set an extent instead of leaving it asNone
. Check this post to see how to define the extent and try include this into the parameter: Getting layer extent in PyQGIS?from qgis.utils import iface
:)'NoneType' object has no attribut 'extent'
. I put the 2 lines for extent between concave hull and v.transform treatment.layer = processing.getObject(enveloppe['OUTPUT']) ext = "%f,%f,%f,%f" %(layer.extent().xMinimum(), layer.extent().xMaximum(), layer.extent().yMinimum(), layer.extent().yMaximum())