GDAL
gdalalg_raster_update.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: gdal "raster update" subcommand
5 * Author: Even Rouault <even dot rouault at spatialys.com>
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_RASTER_UPDATE_INCLUDED
14#define GDALALG_RASTER_UPDATE_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
18#include "gdalalg_clip_common.h"
19
20#include <limits>
21
23
24/************************************************************************/
25/* GDALRasterUpdateAlgorithm */
26/************************************************************************/
27
28class GDALRasterUpdateAlgorithm /* non final */
29 : public GDALRasterPipelineStepAlgorithm,
30 public GDALClipCommon
31{
32 public:
33 static constexpr const char *NAME = "update";
34 static constexpr const char *DESCRIPTION =
35 "Update the destination raster with the content of the input one.";
36 static constexpr const char *HELP_URL = "/programs/gdal_raster_update.html";
37
38 explicit GDALRasterUpdateAlgorithm(bool standaloneStep = false);
39
40 bool CanBeLastStep() const override
41 {
42 return true;
43 }
44
45 bool CanBeMiddleStep() const override
46 {
47 return true;
48 }
49
50 bool IsNativelyStreamingCompatible() const override
51 {
52 return false;
53 }
54
55 bool OutputDatasetAllowedBeforeRunningStep() const override
56 {
57 return true;
58 }
59
60 private:
61 bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
62 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
63
64 std::string m_resampling{};
65 std::vector<std::string> m_warpOptions{};
66 std::vector<std::string> m_transformOptions{};
67 double m_errorThreshold = std::numeric_limits<double>::quiet_NaN();
68 bool m_noUpdateOverviews = false;
69};
70
71/************************************************************************/
72/* GDALRasterUpdateAlgorithmStandalone */
73/************************************************************************/
74
75class GDALRasterUpdateAlgorithmStandalone final
76 : public GDALRasterUpdateAlgorithm
77{
78 public:
79 GDALRasterUpdateAlgorithmStandalone()
80 : GDALRasterUpdateAlgorithm(/* standaloneStep = */ true)
81 {
82 }
83
84 ~GDALRasterUpdateAlgorithmStandalone() override;
85};
86
88
89#endif