mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-03 00:04:47 -04:00
Use gdal_merge.py for GDAL < 3.9
This commit is contained in:
parent
e2a955eee2
commit
833aace899
@ -266,6 +266,19 @@ class merge(GdalAlgorithm):
|
||||
arguments.append(list_file)
|
||||
|
||||
return [
|
||||
self.commandName() + (".bat" if isWindows() else ""),
|
||||
self.commandName() + merge.command_ext(),
|
||||
GdalUtils.escapeAndJoin(arguments),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def command_ext() -> str:
|
||||
"""
|
||||
Returns the gdal_merge command extension
|
||||
"""
|
||||
if isWindows():
|
||||
return ".bat"
|
||||
|
||||
if GdalUtils.version() < 3090000:
|
||||
return ".py"
|
||||
|
||||
return ""
|
||||
|
@ -4866,6 +4866,8 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
alg = merge()
|
||||
alg.initAlgorithm()
|
||||
|
||||
merge_command = alg.commandName() + alg.command_ext()
|
||||
|
||||
with tempfile.TemporaryDirectory() as outdir:
|
||||
# this algorithm creates temporary text file with input layers
|
||||
# so we strip its path, leaving only filename
|
||||
@ -4877,7 +4879,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
[
|
||||
"gdal_merge",
|
||||
merge_command,
|
||||
"-ot Float32 -of GTiff "
|
||||
+ "-o "
|
||||
+ outdir
|
||||
@ -4896,7 +4898,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
[
|
||||
"gdal_merge",
|
||||
merge_command,
|
||||
"-separate -ot Float32 -of GTiff "
|
||||
+ "-o "
|
||||
+ outdir
|
||||
@ -4920,7 +4922,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
[
|
||||
"gdal_merge",
|
||||
merge_command,
|
||||
"-ot Float32 -of GTiff -tap -ps 0.1 0.1 "
|
||||
+ "-o "
|
||||
+ outdir
|
||||
@ -4944,7 +4946,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
self.assertEqual(
|
||||
cmd,
|
||||
[
|
||||
"gdal_merge",
|
||||
merge_command,
|
||||
"-a_nodata -9999.0 -ot Float32 -of GTiff "
|
||||
+ "-o "
|
||||
+ outdir
|
||||
|
Loading…
x
Reference in New Issue
Block a user