Skip to content

Commit 12ab928

Browse files
authoredJan 5, 2017
Merge pull request #3918 from alexbruy/processing-providers
Processing providers updates
2 parents 52b004a + c5835e9 commit 12ab928

29 files changed

+466
-442
lines changed
 

‎python/plugins/processing/algs/gdal/GdalOgrAlgorithmProvider.py renamed to ‎python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
os.path.split(os.path.dirname(__file__))[0], os.pardir))
8787

8888

89-
class GdalOgrAlgorithmProvider(AlgorithmProvider):
89+
class GdalAlgorithmProvider(AlgorithmProvider):
9090

9191
"""This provider incorporates GDAL-based algorithms into the
9292
Processing framework.
@@ -100,10 +100,11 @@ def __init__(self):
100100
self.createAlgsList()
101101

102102
def getDescription(self):
103-
return self.tr('GDAL/OGR')
103+
version = GdalUtils.readableVersion()
104+
return 'GDAL ({})'.format(version)
104105

105106
def getName(self):
106-
return 'gdalogr'
107+
return 'gdal'
107108

108109
def getIcon(self):
109110
return QIcon(os.path.join(pluginPath, 'images', 'gdal.svg'))

‎python/plugins/processing/algs/gdal/GdalUtils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,7 @@ def escapeAndJoin(strList):
186186
@staticmethod
187187
def version():
188188
return int(gdal.VersionInfo('VERSION_NUM'))
189+
190+
@staticmethod
191+
def readableVersion():
192+
return gdal.VersionInfo('RELEASE_NAME')

‎python/plugins/processing/algs/gdal/GridAverage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def getIcon(self):
6060
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
6161

6262
def commandLineName(self):
63-
return "gdalogr:gridaverage"
63+
return "gdal:gridaverage"
6464

6565
def defineCharacteristics(self):
6666
self.name, self.i18n_name = self.trAlgorithm('Grid (Moving average)')

‎python/plugins/processing/algs/gdal/GridDataMetrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def getIcon(self):
6565
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
6666

6767
def commandLineName(self):
68-
return "gdalogr:griddatametrics"
68+
return "gdal:griddatametrics"
6969

7070
def defineCharacteristics(self):
7171
self.name, self.i18n_name = self.trAlgorithm('Grid (Data metrics)')

‎python/plugins/processing/algs/gdal/GridInvDist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def getIcon(self):
6464
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
6565

6666
def commandLineName(self):
67-
return "gdalogr:gridinvdist"
67+
return "gdal:gridinvdist"
6868

6969
def defineCharacteristics(self):
7070
self.name, self.i18n_name = self.trAlgorithm('Grid (Inverse distance to a power)')

‎python/plugins/processing/algs/gdal/GridNearest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def getIcon(self):
6060
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))
6161

6262
def commandLineName(self):
63-
return "gdalogr:gridnearestneighbor"
63+
return "gdal:gridnearestneighbor"
6464

6565
def defineCharacteristics(self):
6666
self.name, self.i18n_name = self.trAlgorithm('Grid (Nearest neighbor)')

‎python/plugins/processing/algs/gdal/gdal2tiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class gdal2tiles(GdalAlgorithm):
6161
WEBVIEWERS = ['all', 'google', 'openlayers', 'leaflet', 'none']
6262

6363
def commandLineName(self):
64-
return "gdalogr:gdal2tiles"
64+
return "gdal:gdal2tiles"
6565

6666
def defineCharacteristics(self):
6767
self.name, self.i18n_name = self.trAlgorithm('gdal2tiles')

‎python/plugins/processing/algs/gdal/gdaladdo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def getIcon(self):
6767
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-overview.png'))
6868

6969
def commandLineName(self):
70-
return "gdalogr:overviews"
70+
return "gdal:overviews"
7171

7272
def defineCharacteristics(self):
7373
self.name, self.i18n_name = self.trAlgorithm('Build overviews (pyramids)')

‎python/plugins/processing/algs/gdal/information.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def getIcon(self):
5050
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-info.png'))
5151

5252
def commandLineName(self):
53-
return "gdalorg:rasterinfo"
53+
return "gdal:gdalinfo"
5454

5555
def defineCharacteristics(self):
5656
self.name, self.i18n_name = self.trAlgorithm('Information')

‎python/plugins/processing/algs/gdal/ogrinfo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class OgrInfo(GdalAlgorithm):
4343
SUMMARY_ONLY = 'SUMMARY_ONLY'
4444
OUTPUT = 'OUTPUT'
4545

46+
def commandLineName(self):
47+
return "gdal:ogrinfo"
48+
4649
def defineCharacteristics(self):
4750
self.name, self.i18n_name = self.trAlgorithm('Information')
4851
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')

‎python/plugins/processing/algs/gdal/polygonize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def getIcon(self):
5050
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'polygonize.png'))
5151

5252
def commandLineName(self):
53-
return "gdalogr:polygonize"
53+
return "gdal:polygonize"
5454

5555
def defineCharacteristics(self):
5656
self.name, self.i18n_name = self.trAlgorithm('Polygonize (raster to vector)')

‎python/plugins/processing/algs/gdal/proximity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def getIcon(self):
6161
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'proximity.png'))
6262

6363
def commandLineName(self):
64-
return "gdalogr:proximity"
64+
return "gdal:proximity"
6565

6666
def defineCharacteristics(self):
6767
self.name, self.i18n_name = self.trAlgorithm('Proximity (raster distance)')

‎python/plugins/processing/algs/gdal/rasterize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def getIcon(self):
7474
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'rasterize.png'))
7575

7676
def commandLineName(self):
77-
return "gdalogr:rasterize"
77+
return "gdal:rasterize"
7878

7979
def defineCharacteristics(self):
8080
self.name, self.i18n_name = self.trAlgorithm('Rasterize (vector to raster)')

‎python/plugins/processing/algs/gdal/rasterize_over.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def getIcon(self):
5252
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'rasterize.png'))
5353

5454
def commandLineName(self):
55-
return "gdalogr:rasterize_over"
55+
return "gdal:rasterize_over"
5656

5757
def defineCharacteristics(self):
5858
self.name, self.i18n_name = self.trAlgorithm('Rasterize (write over existing raster)')

‎python/plugins/processing/algs/gdal/retile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class retile(GdalAlgorithm):
6161
ALGO = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
6262

6363
def commandLineName(self):
64-
return "gdalogr:retile"
64+
return "gdal:retile"
6565

6666
def commandName(self):
6767
return "gdal_retile"

‎python/plugins/processing/algs/gdal/translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def getIcon(self):
7373
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'translate.png'))
7474

7575
def commandLineName(self):
76-
return "gdalogr:translate"
76+
return "gdal:translate"
7777

7878
def defineCharacteristics(self):
7979
self.name, self.i18n_name = self.trAlgorithm('Translate (convert format)')

‎python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ def _loadAlgorithms(self):
9292
self.algs = self.preloadedAlgs
9393

9494
def getDescription(self):
95-
return self.tr('GRASS GIS 7 commands')
95+
version = Grass7Utils.installedVersion()
96+
return 'GRASS GIS ({})'.format(version) if version is not None else "GRASS GIS"
9697

9798
def getName(self):
98-
return 'grass70'
99+
return 'grass7'
99100

100101
def getIcon(self):
101102
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))

‎python/plugins/processing/algs/grass7/Grass7Utils.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from qgis.PyQt.QtCore import QCoreApplication
3636
from processing.core.ProcessingConfig import ProcessingConfig
3737
from processing.core.ProcessingLog import ProcessingLog
38+
from processing.core.SilentProgress import SilentProgress
3839
from processing.tools.system import userFolder, isWindows, isMac, tempFolder, mkdir
3940
from processing.tests.TestData import points
4041

@@ -56,6 +57,8 @@ class Grass7Utils(object):
5657

5758
isGrass7Installed = False
5859

60+
version = None
61+
5962
@staticmethod
6063
def grassBatchJobFilename():
6164
'''This is used in Linux. This is the batch job that we assign to
@@ -74,11 +77,41 @@ def grassScriptFilename():
7477
filename = os.path.join(userFolder(), filename)
7578
return filename
7679

80+
#~ @staticmethod
81+
#~ def installedVersion():
82+
#~ out = Grass7Utils.executeGrass7("grass -v")
83+
#~ # FIXME: I do not know if this should be removed or let the user enter it
84+
#~ # or something like that... This is just a temporary thing
85+
#~ return '7.0.0'
86+
87+
7788
@staticmethod
78-
def getGrassVersion():
79-
# FIXME: I do not know if this should be removed or let the user enter it
80-
# or something like that... This is just a temporary thing
81-
return '7.0.0'
89+
def installedVersion(run=False):
90+
if Grass7Utils.isGrass7Installed and not run:
91+
return Grass7Utils.version
92+
93+
if Grass7Utils.grassPath() is None:
94+
return None
95+
commands = ["grass70 -v"]
96+
with subprocess.Popen(
97+
commands,
98+
shell=True,
99+
stdout=subprocess.PIPE,
100+
stdin=subprocess.DEVNULL,
101+
stderr=subprocess.STDOUT,
102+
universal_newlines=True,
103+
) as proc:
104+
try:
105+
lines = proc.stdout.readlines()
106+
for line in lines:
107+
if "GRASS GIS " in line:
108+
Grass7Utils.version = line.split(" ")[-1].strip()
109+
break
110+
except:
111+
pass
112+
113+
return Grass7Utils.version
114+
82115

83116
@staticmethod
84117
def grassPath():
@@ -140,7 +173,7 @@ def createGrass7Script(commands):
140173
output.write('if "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%PATH%\n')
141174
output.write('if not "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%GRASS_ADDON_PATH%;%PATH%\n')
142175
output.write('\n')
143-
output.write('set GRASS_VERSION=' + Grass7Utils.getGrassVersion() + '\n')
176+
output.write('set GRASS_VERSION=' + Grass7Utils.installedVersion() + '\n')
144177
output.write('if not "%LANG%"=="" goto langset\n')
145178
output.write('FOR /F "usebackq delims==" %%i IN (`"%WINGISBASE%\\etc\\winlocale"`) DO @set LANG=%%i\n')
146179
output.write(':langset\n')

‎python/plugins/processing/algs/otb/OTBAlgorithmProvider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def __init__(self):
4848
self.activate = True
4949

5050
def getDescription(self):
51-
return self.tr("Orfeo Toolbox (Image analysis)")
51+
version = OTBUtils.getInstalledVersion()
52+
return "Orfeo ToolBox ({})".format(version) if version is not None else "Orfeo ToolBox"
5253

5354
def getName(self):
5455
return "otb"

‎python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def getName(self):
300300
return 'qgis'
301301

302302
def getDescription(self):
303-
return self.tr('QGIS geoalgorithms')
303+
return 'QGIS'
304304

305305
def getIcon(self):
306306
return self._icon

‎python/plugins/processing/algs/saga/SagaAlgorithmProvider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def unload(self):
8686

8787
def _loadAlgorithms(self):
8888
self.algs = []
89-
version = SagaUtils.getSagaInstalledVersion(True)
89+
version = SagaUtils.getInstalledVersion(True)
9090
if version is None:
9191
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
9292
self.tr('Problem with SAGA installation: SAGA was not found or is not correctly installed'))
@@ -121,8 +121,8 @@ def _loadAlgorithm(self, descriptionFile, version):
121121
self.tr('Could not open SAGA algorithm: %s\n%s' % (descriptionFile, str(e))))
122122

123123
def getDescription(self):
124-
version = SagaUtils.getSagaInstalledVersion()
125-
return 'SAGA (%s)' % version if version is not None else 'SAGA'
124+
version = SagaUtils.getInstalledVersion()
125+
return 'SAGA ({})'.format(version) if version is not None else 'SAGA'
126126

127127
def getName(self):
128128
return 'saga'

‎python/plugins/processing/algs/saga/SagaUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def createSagaBatchJobFileFromSagaCommands(commands):
112112
_installedVersionFound = False
113113

114114

115-
def getSagaInstalledVersion(runSaga=False):
115+
def getInstalledVersion(runSaga=False):
116116
global _installedVersion
117117
global _installedVersionFound
118118

‎python/plugins/processing/core/Processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
5858
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
5959
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
60-
from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
60+
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider
6161
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
6262
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
6363
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider

‎python/plugins/processing/gui/algnames.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
gdalogr:executesql,Execute SQL on vector layer
2-
gdalogr:rasterinfo,Raster layer information
3-
gdalogr:merge,Merge raster layers
4-
gdalogr:ogr2ogr,Export vector layer
5-
gdalogr:vectorinfo,Vector layer information
6-
gdalogr:pcttorgb,PCT to RGB
7-
gdalogr:rgbtopct,RGB to PCT
8-
gdalogr:sieve,Remove small pixel clumps (nearest neighbour)
9-
gdalogr:translate,Export raster layer
10-
gdalogr:warpreproject,Reproject raster layer
11-
gdalogr:polygonize,Vectorize raster layer
12-
gdalogr:gridrasterize,Rasterize vector layer
13-
gdalogr:gridnearestneighbor,Interpolate (Nearest Neighbor)
14-
gdalogr:griddatametrics,Interpolate (Data metrics)
15-
gdalogr:gridinvdist,Interpolate (Inverse distance weighting)
16-
gdalogr:gridaverage,Interpolate (Average)
17-
gdalogr:contour,Contour lines
1+
gdal:executesql,Execute SQL on vector layer
2+
gdal:rasterinfo,Raster layer information
3+
gdal:merge,Merge raster layers
4+
gdal:ogr2ogr,Export vector layer
5+
gdal:vectorinfo,Vector layer information
6+
gdal:pcttorgb,PCT to RGB
7+
gdal:rgbtopct,RGB to PCT
8+
gdal:sieve,Remove small pixel clumps (nearest neighbour)
9+
gdal:translate,Export raster layer
10+
gdal:warpreproject,Reproject raster layer
11+
gdal:polygonize,Vectorize raster layer
12+
gdal:gridrasterize,Rasterize vector layer
13+
gdal:gridnearestneighbor,Interpolate (Nearest Neighbor)
14+
gdal:griddatametrics,Interpolate (Data metrics)
15+
gdal:gridinvdist,Interpolate (Inverse distance weighting)
16+
gdal:gridaverage,Interpolate (Average)
17+
gdal:contour,Contour lines
1818
qgis:creategrid,Create graticule
1919
saga:changegridvalues,Reclassify (simple)
2020
saga:creategraticule,Create graticule from extent

‎python/plugins/processing/gui/menus.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,41 +73,41 @@
7373

7474
rasterMenu = Processing.tr('&Raster')
7575
projectionsMenu = rasterMenu + "/" + Processing.tr('Projections')
76-
defaultMenuEntries.update({'gdalogr:warpreproject':projectionsMenu,
77-
'gdalogr:assignprojection':projectionsMenu,
78-
'gdalogr:extractprojection':projectionsMenu})
76+
defaultMenuEntries.update({'gdal:warpreproject':projectionsMenu,
77+
'gdal:assignprojection':projectionsMenu,
78+
'gdal:extractprojection':projectionsMenu})
7979
conversionMenu = rasterMenu + "/" + Processing.tr('Conversion')
80-
defaultMenuEntries.update({'gdalogr:rasterize':conversionMenu,
81-
'gdalogr:rasterize_over':conversionMenu,
82-
'gdalogr:polygonize':conversionMenu,
83-
'gdalogr:translate':conversionMenu,
84-
'gdalogr:rgbtopct':conversionMenu,
85-
'gdalogr:pcttorgb':conversionMenu})
80+
defaultMenuEntries.update({'gdal:rasterize':conversionMenu,
81+
'gdal:rasterize_over':conversionMenu,
82+
'gdal:polygonize':conversionMenu,
83+
'gdal:translate':conversionMenu,
84+
'gdal:rgbtopct':conversionMenu,
85+
'gdal:pcttorgb':conversionMenu})
8686
extractionMenu = rasterMenu + "/" + Processing.tr('Extraction')
87-
defaultMenuEntries.update({'gdalogr:contour':extractionMenu,
88-
'gdalogr:cliprasterbyextent':extractionMenu,
89-
'gdalogr:cliprasterbymasklayer':extractionMenu})
87+
defaultMenuEntries.update({'gdal:contour':extractionMenu,
88+
'gdal:cliprasterbyextent':extractionMenu,
89+
'gdal:cliprasterbymasklayer':extractionMenu})
9090
analysisMenu = rasterMenu + "/" + Processing.tr('Analysis')
91-
defaultMenuEntries.update({'gdalogr:sieve':analysisMenu,
92-
'gdalogr:nearblack':analysisMenu,
93-
'gdalogr:fillnodata':analysisMenu,
94-
'gdalogr:proximity':analysisMenu,
95-
'gdalogr:griddatametrics':analysisMenu,
96-
'gdalogr:gridaverage':analysisMenu,
97-
'gdalogr:gridinvdist':analysisMenu,
98-
'gdalogr:gridnearestneighbor':analysisMenu,
99-
'gdalogr:aspect':analysisMenu,
100-
'gdalogr:hillshade':analysisMenu,
101-
'gdalogr:roughness':analysisMenu,
102-
'gdalogr:slope':analysisMenu,
103-
'gdalogr:tpi':analysisMenu,
104-
'gdalogr:tri':analysisMenu})
91+
defaultMenuEntries.update({'gdal:sieve':analysisMenu,
92+
'gdal:nearblack':analysisMenu,
93+
'gdal:fillnodata':analysisMenu,
94+
'gdal:proximity':analysisMenu,
95+
'gdal:griddatametrics':analysisMenu,
96+
'gdal:gridaverage':analysisMenu,
97+
'gdal:gridinvdist':analysisMenu,
98+
'gdal:gridnearestneighbor':analysisMenu,
99+
'gdal:aspect':analysisMenu,
100+
'gdal:hillshade':analysisMenu,
101+
'gdal:roughness':analysisMenu,
102+
'gdal:slope':analysisMenu,
103+
'gdal:tpi':analysisMenu,
104+
'gdal:tri':analysisMenu})
105105
miscMenu = rasterMenu + "/" + Processing.tr('Miscellaneous')
106-
defaultMenuEntries.update({'gdalogr:buildvirtualraster':miscMenu,
107-
'gdalogr:merge':miscMenu,
108-
'gdalogr:rasterinfo':miscMenu,
109-
'gdalogr:overviews':miscMenu,
110-
'gdalogr:tileindex':miscMenu})
106+
defaultMenuEntries.update({'gdal:buildvirtualraster':miscMenu,
107+
'gdal:merge':miscMenu,
108+
'gdal:rasterinfo':miscMenu,
109+
'gdal:overviews':miscMenu,
110+
'gdal:tileindex':miscMenu})
111111

112112

113113
def initializeMenus():

‎python/plugins/processing/tests/AlgorithmsTestBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
4848
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
4949
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
50-
from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
50+
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider
5151
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
5252
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
5353
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider

‎python/plugins/processing/tests/testdata/gdal_algorithm_tests.yaml

Lines changed: 334 additions & 19 deletions
Large diffs are not rendered by default.

‎python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 0 additions & 342 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,348 +2034,6 @@ tests:
20342034
name: expected/convex_hull_fields.gml
20352035
type: vector
20362036

2037-
- algorithm: gdalogr:aspect
2038-
name: aspect with standard parameters
2039-
params:
2040-
BAND: 1
2041-
COMPUTE_EDGES: false
2042-
INPUT:
2043-
name: dem.tif
2044-
type: raster
2045-
TRIG_ANGLE: false
2046-
ZERO_FLAT: false
2047-
ZEVENBERGEN: false
2048-
results:
2049-
OUTPUT:
2050-
hash: 8436df662a44a00762aa29768e5d6ecfaf2d42e9a4da02d8afc6e3f6
2051-
type: rasterhash
2052-
2053-
- algorithm: gdalogr:aspect
2054-
name: aspect without NULL (-9999) values (0 instead)
2055-
params:
2056-
BAND: 1
2057-
COMPUTE_EDGES: false
2058-
INPUT:
2059-
name: dem.tif
2060-
type: raster
2061-
TRIG_ANGLE: false
2062-
ZERO_FLAT: true
2063-
ZEVENBERGEN: false
2064-
results:
2065-
OUTPUT:
2066-
hash: 43cccb440c7febb0095103eee3509b740e9f1bf2b3ad3b8a4c25622e
2067-
type: rasterhash
2068-
2069-
- algorithm: gdalogr:aspect
2070-
name: aspect with trigonometric angle
2071-
params:
2072-
BAND: 1
2073-
COMPUTE_EDGES: false
2074-
INPUT:
2075-
name: dem.tif
2076-
type: raster
2077-
TRIG_ANGLE: true
2078-
ZERO_FLAT: false
2079-
ZEVENBERGEN: false
2080-
results:
2081-
OUTPUT:
2082-
hash: a95e8a09a613b551d3f33dfb4975c430f599dc55f761063ae9529124
2083-
type: rasterhash
2084-
2085-
- algorithm: gdalogr:aspect
2086-
name: aspect zevenbergen
2087-
params:
2088-
BAND: 1
2089-
COMPUTE_EDGES: false
2090-
INPUT:
2091-
name: dem.tif
2092-
type: raster
2093-
TRIG_ANGLE: false
2094-
ZERO_FLAT: false
2095-
ZEVENBERGEN: true
2096-
results:
2097-
OUTPUT:
2098-
hash: 2cd5868b21efbd286f4977795143c89df77ac8976f8bc2a2c4e310d8
2099-
type: rasterhash
2100-
2101-
2102-
- algorithm: gdalogr:aspect
2103-
name: aspect with edges
2104-
params:
2105-
BAND: 1
2106-
COMPUTE_EDGES: true
2107-
INPUT:
2108-
name: dem.tif
2109-
type: raster
2110-
TRIG_ANGLE: false
2111-
ZERO_FLAT: false
2112-
ZEVENBERGEN: false
2113-
results:
2114-
OUTPUT:
2115-
hash: d3a354c6e5f207779bb58f9bd23fd89a9f90a77d81aafc661d0ae077
2116-
type: rasterhash
2117-
2118-
- algorithm: gdalogr:cliprasterbyextent
2119-
name: standard clip raster by extent
2120-
params:
2121-
BIGTIFF: '0'
2122-
COMPRESS: '4'
2123-
INPUT:
2124-
name: dem.tif
2125-
type: raster
2126-
JPEGCOMPRESSION: 75
2127-
PREDICTOR: 1
2128-
PROJWIN: 18.67551824296977,18.697800756150787,45.78984181545589,45.804309302274866
2129-
RTYPE: '5'
2130-
TFW: false
2131-
TILED: false
2132-
ZLEVEL: 6
2133-
results:
2134-
OUTPUT:
2135-
hash: 9913a7c0e1ced2c2ce1cd8f0e8103475bc2b0dd4d1d0adafe4920f93
2136-
type: rasterhash
2137-
2138-
- algorithm: gdalogr:cliprasterbyextent
2139-
name: clip by extent and change no data values
2140-
params:
2141-
BIGTIFF: '0'
2142-
COMPRESS: '4'
2143-
INPUT:
2144-
name: dem.tif
2145-
type: raster
2146-
JPEGCOMPRESSION: 75
2147-
NO_DATA: '-9999'
2148-
PREDICTOR: 1
2149-
PROJWIN: 18.67460436727692,18.698371162148714,45.78995019401027,45.804344168369234
2150-
RTYPE: '5'
2151-
TFW: false
2152-
TILED: false
2153-
ZLEVEL: 6
2154-
results:
2155-
OUTPUT:
2156-
hash: df5de501bcec0c10f738d77f3b48d5545b48f0a22e0e028a8b1ccbe7
2157-
type: rasterhash
2158-
2159-
2160-
- algorithm: gdalogr:cliprasterbymasklayer
2161-
name: clip by extent standard (with crop to cutline)
2162-
params:
2163-
ALPHA_BAND: false
2164-
BIGTIFF: '0'
2165-
COMPRESS: '4'
2166-
CROP_TO_CUTLINE: true
2167-
INPUT:
2168-
name: dem.tif
2169-
type: raster
2170-
JPEGCOMPRESSION: 75
2171-
KEEP_RESOLUTION: false
2172-
MASK:
2173-
name: custom/polygon_mask.gml
2174-
type: vector
2175-
PREDICTOR: 1
2176-
RTYPE: '5'
2177-
TFW: false
2178-
TILED: false
2179-
ZLEVEL: 6
2180-
results:
2181-
OUTPUT:
2182-
hash: 4f4720e4efe59a7f238f622659917bbeb5262369d15d5e2917dbcf8b
2183-
type: rasterhash
2184-
2185-
- algorithm: gdalogr:cliprasterbymasklayer
2186-
name: clip by extent and change no data value
2187-
params:
2188-
ALPHA_BAND: false
2189-
BIGTIFF: '0'
2190-
COMPRESS: '4'
2191-
CROP_TO_CUTLINE: true
2192-
INPUT:
2193-
name: dem.tif
2194-
type: raster
2195-
JPEGCOMPRESSION: 75
2196-
KEEP_RESOLUTION: false
2197-
MASK:
2198-
name: custom/polygon_mask.gml
2199-
type: vector
2200-
NO_DATA: '-9999'
2201-
PREDICTOR: 1
2202-
RTYPE: '5'
2203-
TFW: false
2204-
TILED: false
2205-
ZLEVEL: 6
2206-
results:
2207-
OUTPUT:
2208-
hash: 1e0252e63c65dcf4ed1f2b17d2490d3e0331aeb59d8f59b59554f442
2209-
type: rasterhash
2210-
2211-
- algorithm: gdalogr:cliprasterbymasklayer
2212-
name: clip by extent and add alpha band
2213-
params:
2214-
ALPHA_BAND: true
2215-
BIGTIFF: '0'
2216-
COMPRESS: '4'
2217-
CROP_TO_CUTLINE: true
2218-
INPUT:
2219-
name: dem.tif
2220-
type: raster
2221-
JPEGCOMPRESSION: 75
2222-
KEEP_RESOLUTION: false
2223-
MASK:
2224-
name: custom/polygon_mask.gml
2225-
type: vector
2226-
PREDICTOR: 1
2227-
RTYPE: '5'
2228-
TFW: false
2229-
TILED: false
2230-
ZLEVEL: 6
2231-
results:
2232-
OUTPUT:
2233-
hash: 8f69431c6ff7db5174c1ca8e879ae39582fd4ce86f9b53edae0f38ce
2234-
type: rasterhash
2235-
2236-
- algorithm: gdalogr:cliprasterbymasklayer
2237-
name: clip by extent without cropping to cutline
2238-
params:
2239-
ALPHA_BAND: false
2240-
BIGTIFF: '0'
2241-
COMPRESS: '4'
2242-
CROP_TO_CUTLINE: false
2243-
INPUT:
2244-
name: dem.tif
2245-
type: raster
2246-
JPEGCOMPRESSION: 75
2247-
KEEP_RESOLUTION: false
2248-
MASK:
2249-
name: custom/polygon_mask.gml
2250-
type: vector
2251-
PREDICTOR: 1
2252-
RTYPE: '5'
2253-
TFW: false
2254-
TILED: false
2255-
ZLEVEL: 6
2256-
results:
2257-
OUTPUT:
2258-
hash: 638165612b8cf59c631533438633c6c5b0fd5d3698d6ce75b359eef3
2259-
type: rasterhash
2260-
2261-
- algorithm: gdalogr:hillshade
2262-
name: hillshade standard
2263-
params:
2264-
ALTITUDE: 45.0
2265-
AZIMUTH: 315.0
2266-
BAND: 1
2267-
COMPUTE_EDGES: false
2268-
INPUT:
2269-
name: dem.tif
2270-
type: raster
2271-
SCALE: 1.0
2272-
ZEVENBERGEN: false
2273-
Z_FACTOR: 1.0
2274-
results:
2275-
OUTPUT:
2276-
hash: e5cf91b875b918682e456463165eddc4af4ae8855b143068e198ce2a
2277-
type: rasterhash
2278-
2279-
- algorithm: gdalogr:hillshade
2280-
name: hillshade with edges calculation
2281-
params:
2282-
ALTITUDE: 45.0
2283-
AZIMUTH: 315.0
2284-
BAND: 1
2285-
COMPUTE_EDGES: true
2286-
INPUT:
2287-
name: dem.tif
2288-
type: raster
2289-
SCALE: 1.0
2290-
ZEVENBERGEN: false
2291-
Z_FACTOR: 1.0
2292-
results:
2293-
OUTPUT:
2294-
hash: 570671408b020c9cc817e876f0e8081e0b11920c7d297abfe1cb3368
2295-
type: rasterhash
2296-
2297-
- algorithm: gdalogr:hillshade
2298-
name: hillshade with zevenbergen formula
2299-
params:
2300-
ALTITUDE: 45.0
2301-
AZIMUTH: 315.0
2302-
BAND: 1
2303-
COMPUTE_EDGES: false
2304-
INPUT:
2305-
name: dem.tif
2306-
type: raster
2307-
SCALE: 1.0
2308-
ZEVENBERGEN: true
2309-
Z_FACTOR: 1.0
2310-
results:
2311-
OUTPUT:
2312-
hash: ce2174ab155023367d38785fb867456c6a1ae3535ea0ec5ad7a694d5
2313-
type: rasterhash
2314-
2315-
- algorithm: gdalogr:slope
2316-
name: slope with standard parameters
2317-
params:
2318-
AS_PERCENT: false
2319-
BAND: 1
2320-
COMPUTE_EDGES: false
2321-
INPUT:
2322-
name: dem.tif
2323-
type: raster
2324-
SCALE: 1.0
2325-
ZEVENBERGEN: false
2326-
results:
2327-
OUTPUT:
2328-
hash: 319c470de3315f440371d5df8a6e478a8ecaf1cf904a013dbf1b3a6a
2329-
type: rasterhash
2330-
2331-
- algorithm: gdalogr:slope
2332-
name: slope with edges
2333-
params:
2334-
AS_PERCENT: false
2335-
BAND: 1
2336-
COMPUTE_EDGES: true
2337-
INPUT:
2338-
name: dem.tif
2339-
type: raster
2340-
SCALE: 1.0
2341-
ZEVENBERGEN: false
2342-
results:
2343-
OUTPUT:
2344-
hash: f7f8df8b6517fd8660304f7f2fbd6ade2ae68035f4dd9a224c80b465
2345-
type: rasterhash
2346-
2347-
- algorithm: gdalogr:slope
2348-
name: slope with zevenbergen formula
2349-
params:
2350-
AS_PERCENT: false
2351-
BAND: 1
2352-
COMPUTE_EDGES: false
2353-
INPUT:
2354-
name: dem.tif
2355-
type: raster
2356-
SCALE: 1.0
2357-
ZEVENBERGEN: true
2358-
results:
2359-
OUTPUT:
2360-
hash: 90e42b1bc7be9cf7b4a729c6db44dde0bba39dd33012ade6bc8080e7
2361-
type: rasterhash
2362-
2363-
- algorithm: gdalogr:slope
2364-
name: slope with percent instead of degree
2365-
params:
2366-
AS_PERCENT: true
2367-
BAND: 1
2368-
COMPUTE_EDGES: false
2369-
INPUT:
2370-
name: dem.tif
2371-
type: raster
2372-
SCALE: 1.0
2373-
ZEVENBERGEN: false
2374-
results:
2375-
OUTPUT:
2376-
hash: c9dc888254a571e7fbf66691fb72b35f030f87decf59ce67e32ad89d
2377-
type: rasterhash
2378-
23792037
# These tests dissabled because algs require access to iface which
23802038
# is not available in the test suite.
23812039
#- algorithm: qgis:shortestpathpointtopoint

‎tests/testdata/landsat_4326.tif.aux.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
<MDI key="STATISTICS_MAXIMUM">127</MDI>
55
<MDI key="STATISTICS_MEAN">125.33333333333</MDI>
66
<MDI key="STATISTICS_MINIMUM">124</MDI>
7-
<MDI key="STATISTICS_STDDEV">0.84983658559904</MDI>
7+
<MDI key="STATISTICS_STDDEV">0.8498365855988</MDI>
88
</Metadata>
99
</PAMRasterBand>
1010
<PAMRasterBand band="2">
1111
<Metadata>
1212
<MDI key="STATISTICS_MAXIMUM">141</MDI>
1313
<MDI key="STATISTICS_MEAN">139.33333333333</MDI>
1414
<MDI key="STATISTICS_MINIMUM">137</MDI>
15-
<MDI key="STATISTICS_STDDEV">1.3123346456674</MDI>
15+
<MDI key="STATISTICS_STDDEV">1.3123346456686</MDI>
16+
</Metadata>
17+
</PAMRasterBand>
18+
<PAMRasterBand band="3">
19+
<Metadata>
20+
<MDI key="STATISTICS_MAXIMUM">124</MDI>
21+
<MDI key="STATISTICS_MEAN">117.83333333333</MDI>
22+
<MDI key="STATISTICS_MINIMUM">109</MDI>
23+
<MDI key="STATISTICS_STDDEV">5.0634858436544</MDI>
1624
</Metadata>
1725
</PAMRasterBand>
1826
</PAMDataset>

0 commit comments

Comments
 (0)
Please sign in to comment.