From 560815c9179bc06d5b037de418c33fb86880d7c5 Mon Sep 17 00:00:00 2001 From: Stefan Blumentrath Date: Tue, 1 Oct 2024 08:17:40 +0200 Subject: [PATCH] t.rast.patch.group: include r.buildvrt.gdal (#65) Addresses performance issues with r.buildvrt used with GDAL-linked raster maps --- .../t.rast.patch.group/t.rast.patch.group.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/temporal/t.rast.patch.group/t.rast.patch.group.py b/src/temporal/t.rast.patch.group/t.rast.patch.group.py index 00d18cb9..ba9a1aaf 100644 --- a/src/temporal/t.rast.patch.group/t.rast.patch.group.py +++ b/src/temporal/t.rast.patch.group/t.rast.patch.group.py @@ -65,6 +65,11 @@ # % multiple: no # %end +# %flag +# % key: g +# % description: Use r.buildvrt.gdal for patching (for GDAL-linked raster maps) +# %end + # %flag # % key: z # % description: Use zero (0) for transparency instead of NULL @@ -88,7 +93,8 @@ # %end # %rules -# % excludes: -v,-s,-z +# % excludes: -v,-s,-z,-g +# % excludes: -g,-s,-z,-v # %end import sys @@ -119,7 +125,17 @@ def main(): add_time = flags["t"] patch_s = flags["s"] patch_z = flags["z"] - patch_module = "r.buildvrt" if flags["v"] else "r.patch" + + if flags["g"] and not gs.find_program("r.buildvrt.gdal", "--help"): + gs.fatal( + _("Cannot find addon . Please make sure it is installed.") + ) + if flags["v"]: + patch_module = "r.buildvrt" + elif flags["g"]: + patch_module = "r.buildvrt.gdal" + else: + patch_module = "r.patch" # Make sure the temporal database exists dbif = tgis.init()