GDAL

gdalalg_raster_as_features.h
1/******************************************************************************
2*
3 * Project: GDAL
4 * Purpose: "as-features" step of "gdal pipeline"
5 * Author: Daniel Baston
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, ISciences, LLC
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_RASTER_AS_FEATURES_INCLUDED
14#define GDALALG_RASTER_AS_FEATURES_INCLUDED
15
16#include "gdalalg_abstract_pipeline.h"
17
19
20/************************************************************************/
21/* GDALRasterAsFeaturesAlgorithm */
22/************************************************************************/
23
24 class GDALRasterAsFeaturesAlgorithm /* non final */
25 : public GDALPipelineStepAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "as-features";
29 static constexpr const char *DESCRIPTION =
30 "Create features from pixels of a raster dataset";
31 static constexpr const char *HELP_URL =
32 "/programs/gdal_raster_as_features.html";
33
34 explicit GDALRasterAsFeaturesAlgorithm(bool standaloneStep = false);
35
36 ~GDALRasterAsFeaturesAlgorithm() override;
37
38 int GetInputType() const override
39 {
40 return GDAL_OF_RASTER;
41 }
42
43 int GetOutputType() const override
44 {
45 return GDAL_OF_VECTOR;
46 }
47
48 private:
49 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
50
51 std::vector<int> m_bands{};
52 std::string m_geomTypeName = "none";
53 bool m_skipNoData = false;
54 bool m_includeXY = false;
55 bool m_includeRowCol = false;
56};
57
58/************************************************************************/
59/* GDALRasterAsFeaturesAlgorithmStandalone */
60/************************************************************************/
61
62 class GDALRasterAsFeaturesAlgorithmStandalone final
63 : public GDALRasterAsFeaturesAlgorithm
64{
65 public:
66 GDALRasterAsFeaturesAlgorithmStandalone()
67 : GDALRasterAsFeaturesAlgorithm(/* standaloneStep = */ true)
68 {
69 }
70
71 ~GDALRasterAsFeaturesAlgorithmStandalone() override;
72};
73
75
76#endif
GDAL_OF_RASTER
#define GDAL_OF_RASTER
Allow raster drivers to be used.
Definition gdal.h:1088
GDAL_OF_VECTOR
#define GDAL_OF_VECTOR
Allow vector drivers to be used.
Definition gdal.h:1093