GDAL
gdalalg_raster_create.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: gdal "raster create" 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_CREATE_INCLUDED
14#define GDALALG_RASTER_CREATE_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
19
20/************************************************************************/
21/* GDALRasterCreateAlgorithm */
22/************************************************************************/
23
24class GDALRasterCreateAlgorithm : public GDALRasterPipelineStepAlgorithm
25{
26 public:
27 static constexpr const char *NAME = "create";
28 static constexpr const char *DESCRIPTION = "Create a new raster dataset.";
29 static constexpr const char *HELP_URL = "/programs/gdal_raster_create.html";
30
31 explicit GDALRasterCreateAlgorithm(bool standaloneStep = false) noexcept;
32
33 bool CanBeMiddleStep() const override
34 {
35 return true;
36 }
37
38 bool CanBeFirstStep() const override
39 {
40 return true;
41 }
42
43 private:
44 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
45 bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
46
47 std::vector<int> m_size{};
48 int m_bandCount = 1;
49 std::string m_type = "Byte";
50 std::string m_crs{};
51 std::vector<double> m_bbox{};
52 std::vector<std::string> m_metadata{};
53 std::string m_nodata{};
54 std::vector<double> m_burnValues{};
55 bool m_copyOverviews = false;
56 bool m_copyMetadata = false;
57};
58
59/************************************************************************/
60/* GDALRasterCreateAlgorithmStandalone */
61/************************************************************************/
62
63class GDALRasterCreateAlgorithmStandalone final
64 : public GDALRasterCreateAlgorithm
65{
66 public:
67 GDALRasterCreateAlgorithmStandalone()
68 : GDALRasterCreateAlgorithm(/* standaloneStep = */ true)
69 {
70 }
71
72 ~GDALRasterCreateAlgorithmStandalone() override;
73};
74
76
77#endif