GDAL
gdalalg_raster_reproject.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "reproject" step of "raster pipeline"
5 * Author: Even Rouault <even dot rouault at spatialys.com>
6 *
7 ******************************************************************************
8 * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_RASTER_REPROJECT_INCLUDED
14#define GDALALG_RASTER_REPROJECT_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
18#include <limits>
19
21
22/************************************************************************/
23/* GDALRasterReprojectAlgorithm */
24/************************************************************************/
25
26class GDALRasterReprojectAlgorithm /* non final */
27 : public GDALRasterPipelineStepAlgorithm
28{
29 public:
30 static constexpr const char *NAME = "reproject";
31 static constexpr const char *DESCRIPTION = "Reproject a raster dataset.";
32 static constexpr const char *HELP_URL =
33 "/programs/gdal_raster_reproject.html";
34
35 static std::vector<std::string> GetAliasesStatic()
36 {
38 }
39
40 explicit GDALRasterReprojectAlgorithm(bool standaloneStep = false);
41
42 bool CanHandleNextStep(GDALPipelineStepAlgorithm *) const override;
43
44 private:
45 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
46
47 std::string m_srsCrs{};
48 std::string m_dstCrs{};
49 std::string m_resampling{};
50 std::vector<double> m_resolution{};
51 std::vector<double> m_bbox{};
52 std::string m_bboxCrs{};
53 std::vector<int> m_size{};
54 bool m_targetAlignedPixels = false;
55 std::vector<std::string> m_srcNoData{};
56 std::vector<std::string> m_dstNoData{};
57 bool m_addAlpha = false;
58 std::vector<std::string> m_warpOptions{};
59 std::vector<std::string> m_transformOptions{};
60 double m_errorThreshold = std::numeric_limits<double>::quiet_NaN();
61 int m_numThreads = 0;
62
63 // Work variables
64 std::string m_numThreadsStr{"ALL_CPUS"};
65};
66
67/************************************************************************/
68/* GDALRasterReprojectAlgorithmStandalone */
69/************************************************************************/
70
71class GDALRasterReprojectAlgorithmStandalone final
72 : public GDALRasterReprojectAlgorithm
73{
74 public:
75 GDALRasterReprojectAlgorithmStandalone()
76 : GDALRasterReprojectAlgorithm(/* standaloneStep = */ true)
77 {
78 }
79
80 ~GDALRasterReprojectAlgorithmStandalone() override;
81};
82
83/************************************************************************/
84/* GDALRasterReprojectUtils */
85/************************************************************************/
86
87class GDALRasterReprojectUtils final
88{
89 public:
90 static void AddResamplingArg(GDALAlgorithm *alg, std::string &resampling);
91
92 static void AddWarpOptTransformOptErrorThresholdArg(
93 GDALAlgorithm *alg, std::vector<std::string> &warpOptions,
94 std::vector<std::string> &transformOptions, double &errorThreshold);
95};
96
98
99#endif /* GDALALG_RASTER_REPROJECT_INCLUDED */
static constexpr const char * HIDDEN_ALIAS_SEPARATOR
Special value to put in m_aliases to separate public alias from hidden aliases.
Definition gdalalgorithm_cpp.h:2136