0

I'm trying to classify a raster with PyQGIS:

import processing processing.runalg("otb:unsupervisedkmeansimageclassification","FalseColor.tif",128,None,100,3,1000,0.95,"class.tif",None) The python console indicate :

AttributeError: module 'processing' has no attribute 'runalg'

It is a little bit surprising because I've followed the QGIS documentation. https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/otb/learning.html#unsupervised-kmeans-image-classification

I've seen this post: QGIS 3.0 Error when calling processing.runalg()

I've tried with processing.run: processing.run("otb:unsupervisedkmeansimageclassification","FalseColor.tif",128,None,100,3,1000,0.95,"class.tif",None)

The python console indicate :

TypeError: run() takes from 2 to 5 positional arguments but 10 were given

Is there an updated documentation about the algorithm otb:unsupervisedkmeansimageclassification?

4
  • have you found a solution yet? Would be interested in an answer as well
    – Leo
    Commented Nov 26, 2018 at 13:50
  • No, I haven't found anything interesting. The QGIS documentation is not finished. I hope I will find something later. Commented Nov 27, 2018 at 15:42
  • meanwhile I had success with processing.runAlgorithm instead of processing.runalg
    – Leo
    Commented Nov 28, 2018 at 12:53
  • @geekornolife Hi there, could you share how you managed to call from processing and QGIS 3.4 please? I have been lost ...
    – ODstuck
    Commented Jan 4, 2019 at 22:46

0

Your Answer

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