Line data Source code
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 : 18 : //! @cond Doxygen_Suppress 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 11 : virtual bool AddExtraOptions([[maybe_unused]] CPLStringList &aosOptions) 45 : { 46 11 : 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 : }; 65 : 66 : //! @endcond 67 : 68 : #endif