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);
44 bool CanBeLastStep()
const override
49 bool IsNativelyStreamingCompatible()
const override
54 bool SupportsInputMultiThreading()
const override
62 std::vector<std::string> m_metadata{};
63 bool m_copySrcMetadata =
false;
64 std::string m_tilingScheme{};
65 std::string m_convention =
"xyz";
66 std::string m_resampling{};
67 std::string m_overviewResampling{};
68 int m_minZoomLevel = -1;
69 int m_maxZoomLevel = -1;
70 bool m_noIntersectionIsOK =
false;
75 int m_ovrZoomLevel = -1;
76 int m_minOvrTileX = -1;
77 int m_minOvrTileY = -1;
78 int m_maxOvrTileX = -1;
79 int m_maxOvrTileY = -1;
81 bool m_addalpha =
false;
82 bool m_noalpha =
false;
83 double m_dstNoData = 0;
84 bool m_skipBlank =
false;
85 bool m_auxXML =
false;
86 bool m_resume =
false;
88 bool m_spawned =
false;
89 bool m_forked =
false;
92 std::string m_parallelMethod{};
94 std::string m_excludedValues{};
95 double m_excludedValuesPctThreshold = 50;
96 double m_nodataValuesPctThreshold = 100;
98 std::vector<std::string> m_webviewers{};
100 std::string m_title{};
101 std::string m_copyright{};
102 std::string m_mapmlTemplate{};
105 std::string m_numThreadsStr{
"ALL_CPUS"};
106 std::map<std::string, std::string> m_mapTileMatrixIdentifierToScheme{};
107 GDALDataset *m_poSrcDS =
nullptr;
108 bool m_bIsNamedNonMemSrcDS =
false;
109 GDALDriver *m_poDstDriver =
nullptr;
110 std::string m_osGDALPath{};
113 bool RunImpl(GDALProgressFunc pfnProgress,
void *pProgressData)
override;
114 bool RunStep(GDALPipelineStepRunContext &ctxt)
override;
118 static void ComputeJobChunkSize(
int nMaxJobCount,
int nTilesPerCol,
119 int nTilesPerRow,
double &dfTilesYPerJob,
120 int &nYOuterIterations,
121 double &dfTilesXPerJob,
122 int &nXOuterIterations);
124 bool AddArgToArgv(
const GDALAlgorithmArg *arg,
125 CPLStringList &aosArgv)
const;
127 bool IsCompatibleOfSpawn(
const char *&pszErrorMsg);
129 int GetMaxChildCount(
int nMaxJobCount)
const;
131 void WaitForSpawnedProcesses(
132 bool &bRet,
const std::vector<std::string> &asCommandLines,
133 std::vector<CPLSpawnedProcess *> &ahSpawnedProcesses)
const;
134 bool GenerateBaseTilesSpawnMethod(
135 int nBaseTilesPerCol,
int nBaseTilesPerRow,
int nMinTileX,
136 int nMinTileY,
int nMaxTileX,
int nMaxTileY, uint64_t nTotalTiles,
137 uint64_t nBaseTiles, GDALProgressFunc pfnProgress,
void *pProgressData);
139 bool GenerateOverviewTilesSpawnMethod(
140 int iZ,
int nOvrMinTileX,
int nOvrMinTileY,
int nOvrMaxTileX,
141 int nOvrMaxTileY, std::atomic<uint64_t> &nCurTile, uint64_t nTotalTiles,
142 GDALProgressFunc pfnProgress,
void *pProgressData);
149class GDALRasterTileAlgorithmStandalone final :
public GDALRasterTileAlgorithm
152 GDALRasterTileAlgorithmStandalone()
153 : GDALRasterTileAlgorithm( true)
157 ~GDALRasterTileAlgorithmStandalone()
override;
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:76
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:936
Various convenience functions for working with strings and string lists.
GDALDataType
Definition gdal.h:48