Skip to content
Permalink
Browse files

Restore gdal algorithm support

  • Loading branch information
nyalldawson committed Jun 27, 2017
1 parent 7768f06 commit 014833a6ff6e38994e1e927d68fe33f1b78925e3
Showing with 19 additions and 4 deletions.
  1. +19 −4 python/plugins/processing/algs/gdal/GdalAlgorithm.py
@@ -28,11 +28,12 @@
import os
import re

from qgis.PyQt.QtCore import QUrl
from qgis.PyQt.QtCore import QUrl, QCoreApplication

from qgis.core import (QgsApplication,
QgsVectorFileWriter,
QgsProcessingUtils,
QgsProcessingAlgorithm,
QgsProject)

from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -44,25 +45,28 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class GdalAlgorithm(GeoAlgorithm):
class GdalAlgorithm(QgsProcessingAlgorithm):

def __init__(self):
GeoAlgorithm.__init__(self)
super().__init__()

def icon(self):
return QgsApplication.getThemeIcon("/providerGdal.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerGdal.svg")

def createInstance(self, config={}):
return self.__class__()

def createCustomParametersWidget(self, parent):
return GdalAlgorithmDialog(self)

def getConsoleCommands(self, parameters):
return None

def processAlgorithm(self, parameters, context, feedback):
commands = self.getConsoleCommands(parameters)
commands = self.getConsoleCommands(parameters, context, feedback)
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
supported = QgsVectorFileWriter.supportedFormatExtensions()
for i, c in enumerate(commands):
@@ -80,6 +84,12 @@ def processAlgorithm(self, parameters, context, feedback):
commands[i] = c
GdalUtils.runGdal(commands, feedback)

# auto generate outputs
results = {}
for o in self.outputDefinitions():
results[o.name()] = parameters[o.name()]
return results

def helpUrl(self):
helpPath = GdalUtils.gdalHelpPath()
if helpPath == '':
@@ -100,3 +110,8 @@ def commandName(self):
if name.endswith(".py"):
name = name[:-3]
return name

def tr(self, string, context=''):
if context == '':
context = self.__class__.__name__
return QCoreApplication.translate(context, string)

0 comments on commit 014833a

Please sign in to comment.
You can’t perform that action at this time.