GDAL

gdalalg_raster_index.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: gdal "raster index" 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_INDEX_INCLUDED
14#define GDALALG_RASTER_INDEX_INCLUDED
15
16#include "gdalalg_vector_output_abstract.h"
17
19
20/************************************************************************/
21/* GDALRasterIndexAlgorithm */
22/************************************************************************/
23
24 class CPL_DLL GDALRasterIndexAlgorithm /* non final */
25 : public GDALVectorOutputAbstractAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "index";
29 static constexpr const char *DESCRIPTION =
30 "Create a vector index of raster datasets.";
31 static constexpr const char *HELP_URL = "/programs/gdal_raster_index.html";
32
33 GDALRasterIndexAlgorithm();
34
35 GDALRasterIndexAlgorithm(const std::string &name,
36 const std::string &description,
37 const std::string &helpURL);
38
39 protected:
40 void AddCommonOptions();
41
42 // Virtual method that may be overridden by derived classes to add options
43 // to GDALTileIndex()
44 virtual bool AddExtraOptions([[maybe_unused]] CPLStringList &aosOptions)
45 {
46 return true;
47 }
48
49 std::vector<GDALArgDatasetValue> m_inputDatasets{};
50
51 private:
52 bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
53
54 bool m_recursive = false;
55 std::vector<std::string> m_filenameFilter{};
56 double m_minPixelSize = 0;
57 double m_maxPixelSize = 0;
58 std::string m_locationName = "location";
59 bool m_writeAbsolutePaths = false;
60 std::string m_crs{};
61 std::string m_sourceCrsName{};
62 std::string m_sourceCrsFormat = "auto";
63 std::vector<std::string> m_metadata{};
64 bool m_skipErrors = false;
65
66 static constexpr const char *PROFILE_NONE = "none";
67 static constexpr const char *PROFILE_STAC_GEOPARQUET = "STAC-GeoParquet";
68 std::string m_profile{PROFILE_NONE};
69 std::string m_baseUrl{};
70 static constexpr const char *ID_METHOD_FILENAME = "filename";
71 static constexpr const char *ID_METHOD_MD5 = "md5";
72 static constexpr const char *ID_METHOD_METADATA_ITEM = "metadata-item";
73 std::string m_idMethod{ID_METHOD_FILENAME};
74 std::string m_idMetadataItem{"id"};
75};
76
78
79#endif
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:458