mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Add r.mask algorithm
This commit is contained in:
parent
d5b5c6cd73
commit
ede5f8f097
@ -0,0 +1,8 @@
|
||||
r.mask
|
||||
r.mask.rast - Creates a MASK for limiting raster operation.
|
||||
Raster (r.*)
|
||||
ParameterRaster|raster|Name of raster map to use as mask|False
|
||||
ParameterRaster|input|Name of raster map to which apply the mask|False
|
||||
ParameterString|maskcats|Raster values to use for mask. Format: 1 2 3 thru 7 *|*|False|True
|
||||
*ParameterBoolean|-i|Create inverse mask|False|True
|
||||
OutputRaster|output|Masked
|
||||
@ -0,0 +1,9 @@
|
||||
r.mask
|
||||
r.mask.vect - Creates a MASK for limiting raster operation with a vector layer.
|
||||
Raster (r.*)
|
||||
ParameterVector|vector|Name of vector map to use as mask|1,2|False
|
||||
ParameterRaster|input|Name of raster map to which apply the mask|False
|
||||
*ParameterString|cats|Category values. Example: 1,3,7-9,13|None|False|True
|
||||
*ParameterString|where|WHERE conditions of SQL statement without 'where' keyword|None|True|True
|
||||
*ParameterBoolean|-i|Create inverse mask|False|True
|
||||
OutputRaster|output|Masked
|
||||
49
python/plugins/processing/algs/grass7/ext/r_mask.py
Normal file
49
python/plugins/processing/algs/grass7/ext/r_mask.py
Normal file
@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
r_mask.py
|
||||
---------
|
||||
Date : February 2016
|
||||
Copyright : (C) 2016 by Médéric Ribreux
|
||||
Email : medspx at medspx dot fr
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Médéric Ribreux'
|
||||
__date__ = 'February 2016'
|
||||
__copyright__ = '(C) 2016, Médéric Ribreux'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
|
||||
def processCommand(alg):
|
||||
# Remove output and input
|
||||
clipped = alg.getParameterFromName('input')
|
||||
out = alg.getOutputFromName('output')
|
||||
alg.exportedLayers[out.value] = alg.exportedLayers[clipped.value]
|
||||
alg.removeOutputFromName('output')
|
||||
alg.parameters.remove(clipped)
|
||||
|
||||
alg.processCommand()
|
||||
|
||||
# Re-add the output !
|
||||
alg.addOutput(out)
|
||||
|
||||
|
||||
def processOutputs(alg):
|
||||
out = alg.getOutputValue('output')
|
||||
inputRaster = alg.exportedLayers[out]
|
||||
command = u"r.out.gdal --overwrite -c createopt=\"TFW=YES,COMPRESS=LZW\" input={} output=\"{}\"".format(
|
||||
inputRaster, out)
|
||||
alg.commands.append(command)
|
||||
alg.outputCommands.append(command)
|
||||
36
python/plugins/processing/algs/grass7/ext/r_mask_rast.py
Normal file
36
python/plugins/processing/algs/grass7/ext/r_mask_rast.py
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
r_mask_rast.py
|
||||
--------------
|
||||
Date : February 2016
|
||||
Copyright : (C) 2016 by Médéric Ribreux
|
||||
Email : medspx at medspx dot fr
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Médéric Ribreux'
|
||||
__date__ = 'February 2016'
|
||||
__copyright__ = '(C) 2016, Médéric Ribreux'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import r_mask
|
||||
|
||||
|
||||
def processCommand(alg):
|
||||
r_mask.processCommand(alg)
|
||||
|
||||
|
||||
def processOutputs(alg):
|
||||
r_mask.processOutputs(alg)
|
||||
36
python/plugins/processing/algs/grass7/ext/r_mask_vect.py
Normal file
36
python/plugins/processing/algs/grass7/ext/r_mask_vect.py
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
r_mask_vect.py
|
||||
--------------
|
||||
Date : February 2016
|
||||
Copyright : (C) 2016 by Médéric Ribreux
|
||||
Email : medspx at medspx dot fr
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Médéric Ribreux'
|
||||
__date__ = 'February 2016'
|
||||
__copyright__ = '(C) 2016, Médéric Ribreux'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import r_mask
|
||||
|
||||
|
||||
def processCommand(alg):
|
||||
r_mask.processCommand(alg)
|
||||
|
||||
|
||||
def processOutputs(alg):
|
||||
r_mask.processOutputs(alg)
|
||||
Loading…
x
Reference in New Issue
Block a user