mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[processing][gdal] More descriptive name for separate parameter
in buildvrt algorithm Fixes #19212
This commit is contained in:
parent
4fb9091e6e
commit
76b13ff4c4
@ -83,7 +83,7 @@ class buildvrt(GdalAlgorithm):
|
|||||||
options=self.RESOLUTION_OPTIONS,
|
options=self.RESOLUTION_OPTIONS,
|
||||||
defaultValue=0))
|
defaultValue=0))
|
||||||
self.addParameter(QgsProcessingParameterBoolean(self.SEPARATE,
|
self.addParameter(QgsProcessingParameterBoolean(self.SEPARATE,
|
||||||
QCoreApplication.translate("ParameterVrtDestination", 'Layer stack'),
|
QCoreApplication.translate("ParameterVrtDestination", 'Place each input file into a separate band'),
|
||||||
defaultValue=True))
|
defaultValue=True))
|
||||||
self.addParameter(QgsProcessingParameterBoolean(self.PROJ_DIFFERENCE,
|
self.addParameter(QgsProcessingParameterBoolean(self.PROJ_DIFFERENCE,
|
||||||
QCoreApplication.translate("ParameterVrtDestination", 'Allow projection difference'),
|
QCoreApplication.translate("ParameterVrtDestination", 'Allow projection difference'),
|
||||||
|
@ -41,6 +41,7 @@ from processing.algs.gdal.GridInverseDistance import GridInverseDistance
|
|||||||
from processing.algs.gdal.GridInverseDistanceNearestNeighbor import GridInverseDistanceNearestNeighbor
|
from processing.algs.gdal.GridInverseDistanceNearestNeighbor import GridInverseDistanceNearestNeighbor
|
||||||
from processing.algs.gdal.GridLinear import GridLinear
|
from processing.algs.gdal.GridLinear import GridLinear
|
||||||
from processing.algs.gdal.GridNearestNeighbor import GridNearestNeighbor
|
from processing.algs.gdal.GridNearestNeighbor import GridNearestNeighbor
|
||||||
|
from processing.algs.gdal.buildvrt import buildvrt
|
||||||
from processing.algs.gdal.hillshade import hillshade
|
from processing.algs.gdal.hillshade import hillshade
|
||||||
from processing.algs.gdal.ogr2ogr import ogr2ogr
|
from processing.algs.gdal.ogr2ogr import ogr2ogr
|
||||||
from processing.algs.gdal.proximity import proximity
|
from processing.algs.gdal.proximity import proximity
|
||||||
@ -638,6 +639,56 @@ class TestGdalAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):
|
|||||||
'OUTPUT': output}, context, feedback),
|
'OUTPUT': output}, context, feedback),
|
||||||
['gdal_calc', '--calc "{}" --format JPEG --type Float32 -A {} --A_band 1 --outfile {}'.format(formula, source, output)])
|
['gdal_calc', '--calc "{}" --format JPEG --type Float32 -A {} --A_band 1 --outfile {}'.format(formula, source, output)])
|
||||||
|
|
||||||
|
def testBuildVrt(self):
|
||||||
|
context = QgsProcessingContext()
|
||||||
|
feedback = QgsProcessingFeedback()
|
||||||
|
source = os.path.join(testDataPath, 'dem.tif')
|
||||||
|
alg = buildvrt()
|
||||||
|
alg.initAlgorithm()
|
||||||
|
|
||||||
|
commands = alg.getConsoleCommands({'LAYERS': [source],
|
||||||
|
'OUTPUT': 'd:/temp/test.vrt'}, context, feedback)
|
||||||
|
self.assertEqual(len(commands), 2)
|
||||||
|
self.assertEqual(commands[0], 'gdalbuildvrt')
|
||||||
|
self.assertIn('-resolution average', commands[1])
|
||||||
|
self.assertIn('-separate', commands[1])
|
||||||
|
self.assertNotIn('-allow_projection_difference', commands[1])
|
||||||
|
self.assertIn('-input_file_list', commands[1])
|
||||||
|
self.assertIn('d:/temp/test.vrt', commands[1])
|
||||||
|
|
||||||
|
commands = alg.getConsoleCommands({'LAYERS': [source],
|
||||||
|
'RESOLUTION': 2,
|
||||||
|
'OUTPUT': 'd:/temp/test.vrt'}, context, feedback)
|
||||||
|
self.assertEqual(len(commands), 2)
|
||||||
|
self.assertEqual(commands[0], 'gdalbuildvrt')
|
||||||
|
self.assertIn('-resolution lowest', commands[1])
|
||||||
|
self.assertIn('-separate', commands[1])
|
||||||
|
self.assertNotIn('-allow_projection_difference', commands[1])
|
||||||
|
self.assertIn('-input_file_list', commands[1])
|
||||||
|
self.assertIn('d:/temp/test.vrt', commands[1])
|
||||||
|
|
||||||
|
commands = alg.getConsoleCommands({'LAYERS': [source],
|
||||||
|
'SEPARATE': False,
|
||||||
|
'OUTPUT': 'd:/temp/test.vrt'}, context, feedback)
|
||||||
|
self.assertEqual(len(commands), 2)
|
||||||
|
self.assertEqual(commands[0], 'gdalbuildvrt')
|
||||||
|
self.assertIn('-resolution average', commands[1])
|
||||||
|
self.assertNotIn('-allow_projection_difference', commands[1])
|
||||||
|
self.assertNotIn('-separate', commands[1])
|
||||||
|
self.assertIn('-input_file_list', commands[1])
|
||||||
|
self.assertIn('d:/temp/test.vrt', commands[1])
|
||||||
|
|
||||||
|
commands = alg.getConsoleCommands({'LAYERS': [source],
|
||||||
|
'PROJ_DIFFERENCE': True,
|
||||||
|
'OUTPUT': 'd:/temp/test.vrt'}, context, feedback)
|
||||||
|
self.assertEqual(len(commands), 2)
|
||||||
|
self.assertEqual(commands[0], 'gdalbuildvrt')
|
||||||
|
self.assertIn('-resolution average', commands[1])
|
||||||
|
self.assertIn('-allow_projection_difference', commands[1])
|
||||||
|
self.assertIn('-separate', commands[1])
|
||||||
|
self.assertIn('-input_file_list', commands[1])
|
||||||
|
self.assertIn('d:/temp/test.vrt', commands[1])
|
||||||
|
|
||||||
def testGdalTindex(self):
|
def testGdalTindex(self):
|
||||||
context = QgsProcessingContext()
|
context = QgsProcessingContext()
|
||||||
feedback = QgsProcessingFeedback()
|
feedback = QgsProcessingFeedback()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user