Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_raster_pixel_info.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "raster pixelinfo" 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_PIXEL_INFO_INCLUDED
14
#define GDALALG_RASTER_PIXEL_INFO_INCLUDED
15
16
#include "gdalalg_abstract_pipeline.h"
17
18
#include "cpl_vsi_virtual.h"
19
20
//! @cond Doxygen_Suppress
21
22
/************************************************************************/
23
/*                     GDALRasterPixelInfoAlgorithm                     */
24
/************************************************************************/
25
26
class GDALRasterPixelInfoAlgorithm /* non final */
27
    : public GDALPipelineStepAlgorithm
28
{
29
  public:
30
    static constexpr const char *NAME = "pixel-info";
31
    static constexpr const char *DESCRIPTION =
32
        "Return information on a pixel of a raster dataset.";
33
    static constexpr const char *HELP_URL =
34
        "/programs/gdal_raster_pixel_info.html";
35
36
    explicit GDALRasterPixelInfoAlgorithm(bool standaloneStep = false);
37
    ~GDALRasterPixelInfoAlgorithm() override;
38
39
    bool IsNativelyStreamingCompatible() const override
40
0
    {
41
        // It could potentially be made fully streamable in pipeline mode since
42
        // we read coordinates from an input vector dataset. "Just" needs some
43
        // code reorganization.
44
0
        return false;
45
0
    }
46
47
    int GetInputType() const override
48
0
    {
49
0
        return GDAL_OF_RASTER;
50
0
    }
51
52
    int GetOutputType() const override
53
0
    {
54
0
        return GDAL_OF_VECTOR;
55
0
    }
56
57
  private:
58
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
59
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
60
61
    GDALArgDatasetValue m_vectorDataset{};
62
    std::vector<std::string> m_includeFields{"ALL"};
63
64
    std::vector<int> m_band{};
65
    int m_overview = -1;
66
    std::vector<double> m_pos{};
67
    std::string m_posCrs{};
68
    std::string m_resampling = "nearest";
69
    bool m_promotePixelValueToZ = false;
70
71
    VSIVirtualHandleUniquePtr m_outputFile{};
72
    std::string m_osTmpFilename{};
73
};
74
75
/************************************************************************/
76
/*                GDALRasterPixelInfoAlgorithmStandalone                */
77
/************************************************************************/
78
79
class GDALRasterPixelInfoAlgorithmStandalone final
80
    : public GDALRasterPixelInfoAlgorithm
81
{
82
  public:
83
    GDALRasterPixelInfoAlgorithmStandalone()
84
0
        : GDALRasterPixelInfoAlgorithm(/* standaloneStep = */ true)
85
0
    {
86
0
    }
87
88
    ~GDALRasterPixelInfoAlgorithmStandalone() override;
89
};
90
91
//! @endcond
92
93
#endif