14#ifndef GDAL_PAM_H_INCLUDED
15#define GDAL_PAM_H_INCLUDED
30#define GCIF_GEOTRANSFORM 0x01
31#define GCIF_PROJECTION 0x02
32#define GCIF_METADATA 0x04
35#define GCIF_NODATA 0x001000
36#define GCIF_CATEGORYNAMES 0x002000
37#define GCIF_MINMAX 0x004000
38#define GCIF_SCALEOFFSET 0x008000
39#define GCIF_UNITTYPE 0x010000
40#define GCIF_COLORTABLE 0x020000
42#define GCIF_COLORINTERP 0x020000
43#define GCIF_BAND_METADATA 0x040000
44#define GCIF_RAT 0x080000
45#define GCIF_MASK 0x100000
46#define GCIF_BAND_DESCRIPTION 0x200000
48#define GCIF_ONLY_IF_MISSING 0x10000000
49#define GCIF_PROCESS_BANDS 0x20000000
51#define GCIF_PAM_DEFAULT \
52 (GCIF_GEOTRANSFORM | GCIF_PROJECTION | GCIF_METADATA | GCIF_GCPS | \
53 GCIF_NODATA | GCIF_CATEGORYNAMES | GCIF_MINMAX | GCIF_SCALEOFFSET | \
54 GCIF_UNITTYPE | GCIF_COLORTABLE | GCIF_BAND_METADATA | GCIF_RAT | \
55 GCIF_MASK | GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS | \
56 GCIF_BAND_DESCRIPTION)
61#define GPF_TRIED_READ_FAILED 0x02
62#define GPF_DISABLED 0x04
63#define GPF_AUXMODE 0x08
64#define GPF_NOSAVE 0x10
74class GDALDatasetPamInfo
77 char *pszPamFilename =
nullptr;
79 std::vector<CPLXMLTreeCloser> m_apoOtherNodes{};
83 int bHaveGeoTransform =
false;
84 std::array<double, 6> adfGeoTransform{};
86 std::vector<gdal::GCP> asGCPs{};
94 int bHasMetadata =
false;
109 int IsPamFilenameAPotentialSiblingFile();
115 GDALDatasetPamInfo *psPam =
nullptr;
117 virtual CPLXMLNode *SerializeToXML(
const char *);
121 virtual CPLErr TrySaveXML();
126 virtual const char *BuildPamFilename();
128 void PamInitialize();
131 void SetPhysicalFilename(
const char *);
132 const char *GetPhysicalFilename();
133 void SetSubdatasetName(
const char *);
134 const char *GetSubdatasetName();
135 void SetDerivedDatasetName(
const char *);
148 void DeleteGeoTransform();
158 const char *pszDomain =
"")
override;
160 const char *pszDomain =
"")
override;
161 char **
GetMetadata(
const char *pszDomain =
"")
override;
163 const char *pszDomain =
"")
override;
172 CPLErr IBuildOverviews(
const char *pszResampling,
int nOverviews,
173 const int *panOverviewList,
int nListBands,
174 const int *panBandList, GDALProgressFunc pfnProgress,
181 GDALDatasetPamInfo *GetPamInfo()
191 void SetPamFlags(
int nValue)
204constexpr double GDAL_PAM_DEFAULT_NODATA_VALUE = 0;
208constexpr int64_t GDAL_PAM_DEFAULT_NODATA_VALUE_INT64 =
209 (std::numeric_limits<int64_t>::min)();
210constexpr uint64_t GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64 =
211 (std::numeric_limits<uint64_t>::max)();
221struct GDALRasterBandPamInfo
225 bool bNoDataValueSet =
false;
226 bool bNoDataValueSetAsInt64 =
false;
227 bool bNoDataValueSetAsUInt64 =
false;
229 double dfNoDataValue = GDAL_PAM_DEFAULT_NODATA_VALUE;
230 int64_t nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
231 uint64_t nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
237 char *pszUnitType =
nullptr;
238 char **papszCategoryNames =
nullptr;
240 double dfOffset = 0.0;
241 double dfScale = 1.0;
243 int bHaveMinMax = FALSE;
247 int bHaveStats = FALSE;
255 bool bOffsetSet =
false;
256 bool bScaleSet =
false;
258 void CopyFrom(
const GDALRasterBandPamInfo &sOther);
273 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
276 void PamInitialize();
278 void PamInitializeNoParent();
281 GDALRasterBandPamInfo *psPam =
nullptr;
293 CPLErr SetNoDataValue(
double)
override;
294 CPLErr SetNoDataValueAsInt64(int64_t nNoData)
override;
295 CPLErr SetNoDataValueAsUInt64(uint64_t nNoData)
override;
296 double GetNoDataValue(
int *pbSuccess =
nullptr)
override;
297 int64_t GetNoDataValueAsInt64(
int *pbSuccess =
nullptr)
override;
298 uint64_t GetNoDataValueAsUInt64(
int *pbSuccess =
nullptr)
override;
299 CPLErr DeleteNoDataValue()
override;
307 const char *GetUnitType()
override;
308 CPLErr SetUnitType(
const char *)
override;
310 char **GetCategoryNames()
override;
311 CPLErr SetCategoryNames(
char **)
override;
313 double GetOffset(
int *pbSuccess =
nullptr)
override;
314 CPLErr SetOffset(
double)
override;
315 double GetScale(
int *pbSuccess =
nullptr)
override;
316 CPLErr SetScale(
double)
override;
318 CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
319 GUIntBig *panHistogram,
int bIncludeOutOfRange,
320 int bApproxOK, GDALProgressFunc,
321 void *pProgressData)
override;
323 CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
int *pnBuckets,
324 GUIntBig **ppanHistogram,
int bForce,
325 GDALProgressFunc,
void *pProgressData)
override;
327 CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
int nBuckets,
331 const char *pszDomain =
"")
override;
333 const char *pszDomain =
"")
override;
343 GDALRasterBandPamInfo *GetPamInfo()
352 void ResetNoDataValues();
364class CPL_DLL GDALPamMultiDim
367 std::unique_ptr<Private> d;
373 explicit GDALPamMultiDim(
const std::string &osFilename);
374 virtual ~GDALPamMultiDim();
376 std::shared_ptr<OGRSpatialReference>
378 const std::string &osContext);
381 const std::string &osContext,
384 CPLErr GetStatistics(
const std::string &osArrayFullName,
385 const std::string &osContext,
bool bApproxOK,
386 double *pdfMin,
double *pdfMax,
double *pdfMean,
387 double *pdfStdDev,
GUInt64 *pnValidCount);
389 void SetStatistics(
const std::string &osArrayFullName,
390 const std::string &osContext,
bool bApproxStats,
391 double dfMin,
double dfMax,
double dfMean,
392 double dfStdDev,
GUInt64 nValidCount);
397 const std::string &osContext);
399 static std::shared_ptr<GDALPamMultiDim>
400 GetPAM(
const std::shared_ptr<GDALMDArray> &poParent);
410 std::shared_ptr<GDALPamMultiDim> m_poPam;
413 GDALPamMDArray(
const std::string &osParentName,
const std::string &osName,
414 const std::shared_ptr<GDALPamMultiDim> &poPam,
415 const std::string &osContext = std::string());
417 bool SetStatistics(
bool bApproxStats,
double dfMin,
double dfMax,
418 double dfMean,
double dfStdDev,
GUInt64 nValidCount,
422 const std::shared_ptr<GDALPamMultiDim> &GetPAM()
const
427 CPLErr GetStatistics(
bool bApproxOK,
bool bForce,
double *pdfMin,
428 double *pdfMax,
double *pdfMean,
double *padfStdDev,
429 GUInt64 *pnValidCount, GDALProgressFunc pfnProgress,
430 void *pProgressData)
override;
436 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override;
440int CPL_DLL PamParseHistogram(
CPLXMLNode *psHistItem,
double *pdfMin,
441 double *pdfMax,
int *pnBuckets,
443 int *pbIncludeOutOfRange,
int *pbApproxOK);
445 double dfMin,
double dfMax,
447 int bIncludeOutOfRange,
449CPLXMLNode CPL_DLL *PamHistogramToXMLTree(
double dfMin,
double dfMax,
450 int nBuckets,
GUIntBig *panHistogram,
451 int bIncludeOutOfRange,
int bApprox);
454const char CPL_DLL *PamGetProxy(
const char *);
455const char CPL_DLL *PamAllocateProxy(
const char *);
456const char CPL_DLL *PamDeallocateProxy(
const char *);
457void CPL_DLL PamCleanProxyDB(
void);
Convenient string class based on std::string.
Definition cpl_string.h:307
A color table / palette.
Definition gdal_priv.h:1362
A set of associated raster bands, usually from one file.
Definition gdal_priv.h:495
virtual int GetGCPCount()
Get number of GCPs.
Definition gdaldataset.cpp:1774
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition gdaldataset.cpp:1380
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition gdaldataset.cpp:1864
virtual void ClearStatistics()
Clear statistics.
Definition gdaldataset.cpp:9080
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition gdaldataset.cpp:1301
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition gdaldataset.cpp:550
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition gdaldataset.cpp:1434
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition gdaldataset.cpp:2028
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition gdaldataset.cpp:1196
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition gdaldataset.cpp:4682
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition gdaldataset.cpp:1921
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition gdaldataset.cpp:3245
Class modeling a multi-dimensional array.
Definition gdal_priv.h:3469
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition gdalmajorobject.cpp:325
virtual void SetDescription(const char *)
Set object description.
Definition gdalmajorobject.cpp:102
PAM dataset.
Definition gdal_pam.h:105
PAM raster band.
Definition gdal_pam.h:268
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition gdal_rat.h:32
A single raster band (or channel).
Definition gdal_priv.h:1519
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:153
CPLErr
Error category.
Definition cpl_error.h:37
Definitions for CPL mini XML Parser/Serializer.
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition cpl_port.h:202
#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:1030
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1179
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition cpl_port.h:222
GDALColorInterp
Types of color interpretation for raster bands.
Definition gdal.h:257
@ GCI_Undefined
Definition gdal.h:258
Document node structure.
Definition cpl_minixml.h:55
Ground Control Point.
Definition gdal.h:1168