弃用警告:gdal.py 被放置在一个命名空间中,它现在可以作为 osgeo.gdal 使用

问题描述

我的脚本有问题。我想使用一个包,它允许我直接在我的代码中使用 qgis 软件。这个包叫做 qgis.core。我在安装它时遇到了一些麻烦,但似乎已经完成了。现在的问题是,当我运行允许我执行我想要的处理的脚本时,我收到一条错误消息。我会把你放在脚本和错误之下。 如果有人可以帮助我,谢谢。

脚本:

from qgis.core import QgsProcessing
from qgis.core import QgsProcessingalgorithm
from qgis.core import QgsProcessingMultiStepFeedback
from qgis.core import QgsProcessingParameterRasterDestination
import processing

class Modle(QgsProcessingalgorithm):
def initAlgorithm(self,config=None):
    self.addParameter(QgsProcessingParameterRasterDestination('Fuzzy','fuzzy',createByDefault=True,defaultValue='MYPATH\Fuzzy.sdat'))

def processAlgorithm(self,parameters,context,model_Feedback):
    # Use a multi-step Feedback,so that individual child algorithm progress reports are adjusted for the
    # overall progress through the model
    Feedback = QgsProcessingMultiStepFeedback(1,model_Feedback)
    results = {}
    outputs = {}

    # Fuzzify
    alg_params = {
        'A': 0.3,'AUTOFIT     ': False,'B': 0.7,'C': 0,'D': 0,'INPUT': 'MYPICTURE.tif','TYPE': 0,'OUTPUT': parameters['Fuzzy']
    }
    outputs['Fuzzify'] = processing.run('saga:fuzzify',alg_params,context=context,Feedback=Feedback,is_child_algorithm=True)
    results['Fuzzy'] = outputs['Fuzzify']['OUTPUT']
    return results

def name(self):
    return 'Modèle'

def displayName(self):
    return 'Modèle'

def group(self):
    return ''

def groupId(self):
    return ''

def createInstance(self):
    return Modle()

回报:

DeprecationWarning: gdal.py was placed in a namespace,it is Now available as osgeo.gdal
  DeprecationWarning)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...