Skip to content

Commit

Permalink
[processing] add gdal command name to tags for better searches (#6978)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed May 14, 2018
1 parent 272f9ef commit 8f47691
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 46 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/AssignProjection.py
Expand Up @@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/Buffer.py
Expand Up @@ -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)]
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ClipRasterByExtent.py
Expand Up @@ -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)]
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ClipVectorByExtent.py
Expand Up @@ -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)]
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ClipVectorByMask.py
Expand Up @@ -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)]
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/Dissolve.py
Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/ExecuteSql.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)]
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/gdal/GdalAlgorithm.py
Expand Up @@ -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")

Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/GridAverage.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/GridDataMetrics.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/GridInverseDistance.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/GridLinear.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/GridNearestNeighbor.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/buildvrt.py
Expand Up @@ -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')
Expand All @@ -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)]
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/gdal/extractprojection.py
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/fillnodata.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/gdal2tiles.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/gdal2xyz.py
Expand Up @@ -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
7 changes: 5 additions & 2 deletions python/plugins/processing/algs/gdal/merge.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/pct2rgb.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/polygonize.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/proximity.py
Expand Up @@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/rasterize.py
Expand Up @@ -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)]
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/gdal/rasterize_over.py
Expand Up @@ -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)
Expand All @@ -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)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/retile.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/rgb2pct.py
Expand Up @@ -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
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/sieve.py
Expand Up @@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/tpi.py
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/tri.py
Expand Up @@ -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')
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/processing/algs/gdal/warp.py
Expand Up @@ -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:
Expand Down

0 comments on commit 8f47691

Please sign in to comment.