ccrook / QGIS-Contour-Plugin

Contour plugin for QGIS - uses python matplotlib to generate contours of data on vector point data.
44 stars 13 forks source link

Error on processing algorithm using the same parameters' name #28

Closed ftharyanto closed 6 years ago

ftharyanto commented 6 years ago

Error when I tried to generate a second contour using the exact same name of parameters including 'InputField' and 'InputLayer'.

Using this code:

import processing
layer=iface.mapCanvas().currentLayer()
result=processing.run(
   "contourplugin:generatecontours",
      { 'ContourInterval' : 1, 
        'ContourLevels' : '', 
        'ContourMethod' : 1, 
        'ContourType' : 0, 
        'DuplicatePointTolerance' : 0, 
        'ExtendOption' : 0, 
        'InputField' : '"z"', 
        'InputLayer' : layer,
        'LabelDecimalPlaces' : -1, 
        'LabelTrimZeros' : False, 
        'LabelUnits' : '', 
        'MaxContourValue' : None, 
        'MinContourValue' : None, 
        'NContour' : 20, 
        'OutputLayer' : 'memory:' }
        )
layer=result['OutputLayer']
QgsProject.instance().addMapLayer(layer)

This is what I got:

Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 19, in <module>
  File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 84, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 194, in runAlgorithm
    raise QgsProcessingException(msg)
_core.QgsProcessingException: There were errors executing the algorithm.

tried on Ubuntu 18.04

ftharyanto commented 6 years ago

Oh, I was selecting the 'output' layer. Sorry, my mistake. It works now. Solved.