/src/gdal/apps/gdalalg_raster_as_features.h
Line | Count | Source |
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 | | |
18 | | //! @cond Doxygen_Suppress |
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 | 0 | { |
40 | 0 | return GDAL_OF_RASTER; |
41 | 0 | } |
42 | | |
43 | | int GetOutputType() const override |
44 | 0 | { |
45 | 0 | return GDAL_OF_VECTOR; |
46 | 0 | } |
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 | 0 | : GDALRasterAsFeaturesAlgorithm(/* standaloneStep = */ true) |
68 | 0 | { |
69 | 0 | } |
70 | | |
71 | | ~GDALRasterAsFeaturesAlgorithmStandalone() override; |
72 | | }; |
73 | | |
74 | | //! @endcond |
75 | | |
76 | | #endif |