mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-06 00:03:16 -05:00
Raise exceptions if open options not supported by GDAL version
This commit is contained in:
parent
c0ad63cf36
commit
2d27784cee
@ -181,6 +181,9 @@ class GridAverage(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -195,6 +195,9 @@ class GridDataMetrics(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -204,6 +204,9 @@ class GridInverseDistance(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -189,6 +189,9 @@ class GridInverseDistanceNearestNeighbor(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -161,6 +161,9 @@ class GridLinear(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -173,6 +173,9 @@ class GridNearestNeighbor(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr('Open options are not supported by gdal_grid version {} (requires GDAL version 3.7 or later)'.format(GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
options = self.parameterAsString(parameters, self.OPTIONS, context)
|
||||
|
||||
@ -234,6 +234,11 @@ class rasterize(GdalAlgorithm):
|
||||
arguments.append(output_format)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr(
|
||||
'Open options are not supported by gdal_rasterize version {} (requires GDAL version 3.7 or later)'.format(
|
||||
GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
if input_details.credential_options:
|
||||
|
||||
@ -120,6 +120,11 @@ class rasterize_over(GdalAlgorithm):
|
||||
arguments.append(extra)
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr(
|
||||
'Open options are not supported by gdal_rasterize version {} (requires GDAL version 3.7 or later)'.format(
|
||||
GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
if input_details.credential_options:
|
||||
|
||||
@ -113,6 +113,11 @@ class rasterize_over_fixed_value(GdalAlgorithm):
|
||||
arguments.append('-add')
|
||||
|
||||
if input_details.open_options:
|
||||
if GdalUtils.version() < 3070000:
|
||||
raise QgsProcessingException(self.tr(
|
||||
'Open options are not supported by gdal_rasterize version {} (requires GDAL version 3.7 or later)'.format(
|
||||
GdalUtils.readableVersion())))
|
||||
|
||||
arguments.extend(input_details.open_options_as_arguments())
|
||||
|
||||
if input_details.credential_options:
|
||||
|
||||
@ -1030,6 +1030,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.jpg'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1102,6 +1103,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.tif'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1167,6 +1169,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.tif'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1232,6 +1235,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.tif'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1297,6 +1301,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.tif'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1362,6 +1367,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.tif'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'EXTRA': '-z_multiply 1.5 -outsize 1754 1394',
|
||||
@ -1987,6 +1993,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
source + ' ' +
|
||||
outdir + '/check.jpg'])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': source + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'FIELD': 'id',
|
||||
@ -2040,6 +2047,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
'-l polys2 -a id -i ' +
|
||||
vector + ' ' + raster])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': vector + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'FIELD': 'id',
|
||||
@ -2091,6 +2099,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
'-l polys2 -burn 100.0 -i ' +
|
||||
vector + ' ' + raster])
|
||||
|
||||
if GdalUtils.version() >= 3070000:
|
||||
self.assertEqual(
|
||||
alg.getConsoleCommands({'INPUT': vector + '|option:X_POSSIBLE_NAMES=geom_x|option:Y_POSSIBLE_NAMES=geom_y',
|
||||
'BURN': 100,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user