mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -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)
|
arguments.append(list_file)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
self.commandName() + (".bat" if isWindows() else ""),
|
self.commandName() + merge.command_ext(),
|
||||||
GdalUtils.escapeAndJoin(arguments),
|
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 = merge()
|
||||||
alg.initAlgorithm()
|
alg.initAlgorithm()
|
||||||
|
|
||||||
|
merge_command = alg.commandName() + alg.command_ext()
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as outdir:
|
with tempfile.TemporaryDirectory() as outdir:
|
||||||
# this algorithm creates temporary text file with input layers
|
# this algorithm creates temporary text file with input layers
|
||||||
# so we strip its path, leaving only filename
|
# so we strip its path, leaving only filename
|
||||||
@ -4877,7 +4879,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
"gdal_merge",
|
merge_command,
|
||||||
"-ot Float32 -of GTiff "
|
"-ot Float32 -of GTiff "
|
||||||
+ "-o "
|
+ "-o "
|
||||||
+ outdir
|
+ outdir
|
||||||
@ -4896,7 +4898,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
"gdal_merge",
|
merge_command,
|
||||||
"-separate -ot Float32 -of GTiff "
|
"-separate -ot Float32 -of GTiff "
|
||||||
+ "-o "
|
+ "-o "
|
||||||
+ outdir
|
+ outdir
|
||||||
@ -4920,7 +4922,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
"gdal_merge",
|
merge_command,
|
||||||
"-ot Float32 -of GTiff -tap -ps 0.1 0.1 "
|
"-ot Float32 -of GTiff -tap -ps 0.1 0.1 "
|
||||||
+ "-o "
|
+ "-o "
|
||||||
+ outdir
|
+ outdir
|
||||||
@ -4944,7 +4946,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
"gdal_merge",
|
merge_command,
|
||||||
"-a_nodata -9999.0 -ot Float32 -of GTiff "
|
"-a_nodata -9999.0 -ot Float32 -of GTiff "
|
||||||
+ "-o "
|
+ "-o "
|
||||||
+ outdir
|
+ outdir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user