13#ifndef GDALALG_RASTER_TILE_INCLUDED
14#define GDALALG_RASTER_TILE_INCLUDED
16#include "gdalalg_raster_pipeline.h"
27typedef struct _CPLSpawnedProcess CPLSpawnedProcess;
33class GDALRasterTileAlgorithm
34 :
public GDALRasterPipelineStepAlgorithm
37 static constexpr const char *NAME =
"tile";
38 static constexpr const char *DESCRIPTION =
39 "Generate tiles in separate files from a raster dataset.";
40 static constexpr const char *HELP_URL =
"/programs/gdal_raster_tile.html";
42 explicit GDALRasterTileAlgorithm(
bool standaloneStep =
false);
43 ~GDALRasterTileAlgorithm()
override;
45 bool CanBeLastStep()
const override
50 bool IsNativelyStreamingCompatible()
const override
55 bool SupportsInputMultiThreading()
const override
60 int GetOutputType()
const override
68 std::string m_outputDir{};
69 std::vector<std::string> m_metadata{};
70 bool m_copySrcMetadata =
false;
71 std::string m_tilingScheme{};
72 std::string m_convention =
"xyz";
73 std::string m_resampling{};
74 std::string m_overviewResampling{};
75 int m_minZoomLevel = -1;
76 int m_maxZoomLevel = -1;
77 bool m_noIntersectionIsOK =
false;
82 int m_ovrZoomLevel = -1;
83 int m_minOvrTileX = -1;
84 int m_minOvrTileY = -1;
85 int m_maxOvrTileX = -1;
86 int m_maxOvrTileY = -1;
88 bool m_addalpha =
false;
89 bool m_noalpha =
false;
90 double m_dstNoData = 0;
91 bool m_skipBlank =
false;
92 bool m_auxXML =
false;
93 bool m_resume =
false;
95 bool m_spawned =
false;
96 bool m_forked =
false;
99 std::string m_parallelMethod{};
101 std::string m_excludedValues{};
102 double m_excludedValuesPctThreshold = 50;
103 double m_nodataValuesPctThreshold = 100;
105 std::vector<std::string> m_webviewers{};
107 std::string m_title{};
108 std::string m_copyright{};
109 std::string m_mapmlTemplate{};
112 std::string m_numThreadsStr{
"ALL_CPUS"};
113 std::map<std::string, std::string> m_mapTileMatrixIdentifierToScheme{};
116 bool m_bIsNamedNonMemSrcDS =
false;
118 std::string m_osGDALPath{};
121 bool RunImpl(GDALProgressFunc pfnProgress,
void *pProgressData)
override;
122 bool RunStep(GDALPipelineStepRunContext &ctxt)
override;
126 static void ComputeJobChunkSize(
int nMaxJobCount,
int nTilesPerCol,
127 int nTilesPerRow,
double &dfTilesYPerJob,
128 int &nYOuterIterations,
129 double &dfTilesXPerJob,
130 int &nXOuterIterations);
135 bool IsCompatibleOfSpawn(
const char *&pszErrorMsg);
137 int GetMaxChildCount(
int nMaxJobCount)
const;
139 void WaitForSpawnedProcesses(
140 bool &bRet,
const std::vector<std::string> &asCommandLines,
141 std::vector<CPLSpawnedProcess *> &ahSpawnedProcesses)
const;
142 bool GenerateBaseTilesSpawnMethod(
143 int nBaseTilesPerCol,
int nBaseTilesPerRow,
int nMinTileX,
144 int nMinTileY,
int nMaxTileX,
int nMaxTileY, uint64_t nTotalTiles,
145 uint64_t nBaseTiles, GDALProgressFunc pfnProgress,
void *pProgressData);
147 bool GenerateOverviewTilesSpawnMethod(
148 int iZ,
int nOvrMinTileX,
int nOvrMinTileY,
int nOvrMaxTileX,
149 int nOvrMaxTileY, std::atomic<uint64_t> &nCurTile, uint64_t nTotalTiles,
150 GDALProgressFunc pfnProgress,
void *pProgressData);
157class GDALRasterTileAlgorithmStandalone final :
public GDALRasterTileAlgorithm
160 GDALRasterTileAlgorithmStandalone()
161 : GDALRasterTileAlgorithm( true)
165 ~GDALRasterTileAlgorithmStandalone()
override;
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:476
Argument of an algorithm.
Definition gdalalgorithm_cpp.h:1270
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:77
Format specific driver.
Definition gdal_driver.h:63
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:1101
Various convenience functions for working with strings and string lists.
GDALDataType
Definition gdal.h:48