Skip to content
Permalink
Browse files

[processing] add gdal command name to tags for better searches (#6978)

  • Loading branch information
nirvn committed May 14, 2018
1 parent 272f9ef commit 8f47691a7a1b403e48991b6d26e5e713c0cdfeca
Showing with 87 additions and 46 deletions.
  1. +2 −2 python/plugins/processing/algs/gdal/AssignProjection.py
  2. +1 −1 python/plugins/processing/algs/gdal/Buffer.py
  3. +1 −1 python/plugins/processing/algs/gdal/ClipRasterByExtent.py
  4. +1 −1 python/plugins/processing/algs/gdal/ClipVectorByExtent.py
  5. +1 −1 python/plugins/processing/algs/gdal/ClipVectorByMask.py
  6. +1 −1 python/plugins/processing/algs/gdal/Dissolve.py
  7. +4 −1 python/plugins/processing/algs/gdal/ExecuteSql.py
  8. +3 −0 python/plugins/processing/algs/gdal/GdalAlgorithm.py
  9. +4 −1 python/plugins/processing/algs/gdal/GridAverage.py
  10. +4 −1 python/plugins/processing/algs/gdal/GridDataMetrics.py
  11. +4 −1 python/plugins/processing/algs/gdal/GridInverseDistance.py
  12. +4 −1 python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py
  13. +4 −1 python/plugins/processing/algs/gdal/GridLinear.py
  14. +4 −1 python/plugins/processing/algs/gdal/GridNearestNeighbor.py
  15. +4 −1 python/plugins/processing/algs/gdal/buildvrt.py
  16. +4 −1 python/plugins/processing/algs/gdal/extractprojection.py
  17. +2 −2 python/plugins/processing/algs/gdal/fillnodata.py
  18. +2 −2 python/plugins/processing/algs/gdal/gdal2tiles.py
  19. +2 −2 python/plugins/processing/algs/gdal/gdal2xyz.py
  20. +5 −2 python/plugins/processing/algs/gdal/merge.py
  21. +2 −2 python/plugins/processing/algs/gdal/pct2rgb.py
  22. +2 −2 python/plugins/processing/algs/gdal/polygonize.py
  23. +2 −2 python/plugins/processing/algs/gdal/proximity.py
  24. +1 −1 python/plugins/processing/algs/gdal/rasterize.py
  25. +4 −4 python/plugins/processing/algs/gdal/rasterize_over.py
  26. +2 −2 python/plugins/processing/algs/gdal/retile.py
  27. +2 −2 python/plugins/processing/algs/gdal/rgb2pct.py
  28. +2 −2 python/plugins/processing/algs/gdal/sieve.py
  29. +1 −1 python/plugins/processing/algs/gdal/tpi.py
  30. +1 −1 python/plugins/processing/algs/gdal/tri.py
  31. +5 −3 python/plugins/processing/algs/gdal/warp.py
  32. +6 −0 python/plugins/processing/tests/GdalAlgorithmsTest.py
@@ -94,10 +94,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_edit.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_edit.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

self.setOutputValue(self.OUTPUT, fileName)
return commands
@@ -155,4 +155,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if outputFormat:
arguments.append('-f {}'.format(outputFormat))

return ['ogr2ogr', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -144,4 +144,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(inLayer.source())
arguments.append(out)

return ['gdal_translate', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -108,4 +108,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if outputFormat:
arguments.append('-f {}'.format(outputFormat))

return ['ogr2ogr', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -104,4 +104,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if outputFormat:
arguments.append('-f {}'.format(outputFormat))

return ['ogr2ogr', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -181,4 +181,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if outputFormat:
arguments.append('-f {}'.format(outputFormat))

return ['ogr2ogr', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -85,6 +85,9 @@ def group(self):
def groupId(self):
return 'vectormiscellaneous'

def commandName(self):
return "ogr2ogr"

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)
sql = self.parameterAsString(parameters, self.SQL, context)
@@ -114,4 +117,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if outputFormat:
arguments.append('-f {}'.format(outputFormat))

return ['ogr2ogr', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -52,6 +52,9 @@ def __init__(self):
def icon(self):
return QgsApplication.getThemeIcon("/providerGdal.svg")

def tags(self):
return ['ogr', 'gdal', self.commandName()]

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

@@ -138,6 +138,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -172,4 +175,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -152,6 +152,9 @@ def group(self):
def groupId(self):
return 'rasteranalysis'

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -186,4 +189,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -158,6 +158,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -195,4 +198,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -145,6 +145,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -180,4 +183,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -120,6 +120,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -151,4 +154,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -133,6 +133,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandName(self):
return 'gdal_grid'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
ogrLayer, layerName = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing)

@@ -166,4 +169,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_grid', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -104,6 +104,9 @@ def group(self):
def groupId(self):
return 'rastermiscellaneous'

def commandName(self):
return "gdalbuildvrt"

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
arguments.append('-resolution')
@@ -121,4 +124,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
arguments.append(out)

return ['gdalbuildvrt', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -66,8 +66,11 @@ def group(self):
def groupId(self):
return 'rasterprojections'

def commandName(self):
return 'extractprojection'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
return ["extractprojection"]
return [self.commandName()]

def processAlgorithm(self, parameters, context, feedback):
rasterPath = self.getParameterValue(self.INPUT)
@@ -126,10 +126,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_fillnodata.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_fillnodata.py',
commands = [self.commandName() + '.py',
GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -228,10 +228,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal2tiles.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal2tiles.py',
commands = [self.commandName() + '.py',
GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -92,9 +92,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal2xyz.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal2xyz.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -124,6 +124,9 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'merge.png'))

def commandName(self):
return 'gdal_merge'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)

@@ -165,9 +168,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_merge.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_merge.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -103,9 +103,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'pct2rgb.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['pct2rgb.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -115,10 +115,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_polygonize.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_polygonize.py',
commands = [self.commandName() + '.py',
GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -187,10 +187,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_proximity.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_proximity.py',
commands = [self.commandName() + '.py',
GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -219,4 +219,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(out)

return ['gdal_rasterize', GdalUtils.escapeAndJoin(arguments)]
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -70,6 +70,9 @@ def group(self):
def groupId(self):
return 'vectorconversion'

def commandName(self):
return 'gdal_rasterize'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
context = dataobjects.createContext()
inLayer = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.INPUT), context)
@@ -87,7 +90,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(ogrLayer)
arguments.append(ogrRasterLayer)

return ['gdal_rasterize', GdalUtils.escapeAndJoin(arguments)]

def commandName(self):
return "gdal_rasterize"
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
@@ -212,10 +212,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_retile.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_retile.py',
commands = [self.commandName() + '.py',
GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -96,9 +96,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(out)

if isWindows():
commands = ['cmd.exe', '/C ', 'rgb2pct.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['rgb2pct.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -121,9 +121,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

commands = []
if isWindows():
commands = ['cmd.exe', '/C ', 'gdal_sieve.bat',
commands = ['cmd.exe', '/C ', self.commandName() + '.bat',
GdalUtils.escapeAndJoin(arguments)]
else:
commands = ['gdal_sieve.py', GdalUtils.escapeAndJoin(arguments)]
commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)]

return commands
@@ -77,7 +77,7 @@ def name(self):
return 'tpitopographicpositionindex'

def displayName(self):
return self.tr('TPI (Topographic Position Index)')
return self.tr('Topographic Position Index (TPI)')

def group(self):
return self.tr('Raster analysis')
@@ -76,7 +76,7 @@ def name(self):
return 'triterrainruggednessindex'

def displayName(self):
return self.tr('TRI (Terrain Ruggedness Index)')
return self.tr('Terrain Ruggedness Index (TRI)')

def group(self):
return self.tr('Raster analysis')
@@ -156,12 +156,14 @@ def groupId(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'warp.png'))

def tags(self):
return self.tr('transform,reproject,crs,srs').split(',')

def commandName(self):
return 'gdalwarp'

def tags(self):
tags = self.tr('transform,reproject,crs,srs').split(',')
tags.extend(super().tags())
return tags

def getConsoleCommands(self, parameters, context, feedback, executing=True):
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context)
if inLayer is None:

0 comments on commit 8f47691

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