[QGIS-it-user] QgsProcessingAlgorithm.initAlgorithm() is abstract and must be overridden

Giacomo Fontanelli giacomofontanelli76 a gmail.com
Lun 21 Dic 2020 09:19:06 PST


sto cercando di scrivere uno script per processing.

Potrei includervi anche tutto il listato ma sarebbe inutile, perchè anche
tentando di fare girare la parte di script che trovate qui sotto ricevo un
errore

WARNING    NotImplementedError: QgsProcessingAlgorithm.initAlgorithm() is
abstract and must be overridden


from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (
    QgsProcessing,
    QgsProcessingAlgorithm,
    QgsProcessingParameterVectorLayer,
    QgsProcessingParameterRasterLayer,
    QgsProcessingParameterString,
    QgsProcessingParameterEnum,
    QgsProcessingOutputVectorLayer)
from qgis import processing

class mioScript(QgsProcessingAlgorithm):

    # 2A
    INPUT_RASTER = 'INPUT_RASTER'
    INPUT_VECTOR = 'INPUT_VECTOR'
    COLUMN_PREFIX = 'COLUMN_PREFIX'
    STATISTICS = 'STATISTICS'

    # 2B
    def tr(self, string):
        return QCoreApplication.translate('Processing', string)

    # 2C
    def createInstance(self):
        return mioScript()

    # 2D
    def name(self):
        return 'Zonal stat for stacks'

    # 2E
    def displayName(self):
        return self.tr('Zonal stat for stacks')

    # 2F
    def group(self):
        return self.tr('RS')

    # 2G
    def groupId(self):
        return 'rasteranalysis'

    # 2H
    def shortHelpString(self):
        return self.tr("This script perform statistics on multilayer
stacks")
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.osgeo.org/pipermail/qgis-it-user/attachments/20201221/96004446/attachment.html>


Maggiori informazioni sulla lista QGIS-it-user