30 #ifndef GDAL_PAM_H_INCLUDED
31 #define GDAL_PAM_H_INCLUDED
42 #define GCIF_GEOTRANSFORM 0x01
43 #define GCIF_PROJECTION 0x02
44 #define GCIF_METADATA 0x04
45 #define GCIF_GCPS 0x08
47 #define GCIF_NODATA 0x001000
48 #define GCIF_CATEGORYNAMES 0x002000
49 #define GCIF_MINMAX 0x004000
50 #define GCIF_SCALEOFFSET 0x008000
51 #define GCIF_UNITTYPE 0x010000
52 #define GCIF_COLORTABLE 0x020000
53 #define GCIF_COLORINTERP 0x020000
54 #define GCIF_BAND_METADATA 0x040000
55 #define GCIF_RAT 0x080000
56 #define GCIF_MASK 0x100000
57 #define GCIF_BAND_DESCRIPTION 0x200000
59 #define GCIF_ONLY_IF_MISSING 0x10000000
60 #define GCIF_PROCESS_BANDS 0x20000000
62 #define GCIF_PAM_DEFAULT (GCIF_GEOTRANSFORM | GCIF_PROJECTION | \
63 GCIF_METADATA | GCIF_GCPS | \
64 GCIF_NODATA | GCIF_CATEGORYNAMES | \
65 GCIF_MINMAX | GCIF_SCALEOFFSET | \
66 GCIF_UNITTYPE | GCIF_COLORTABLE | \
67 GCIF_COLORINTERP | GCIF_BAND_METADATA | \
68 GCIF_RAT | GCIF_MASK | \
69 GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS|\
70 GCIF_BAND_DESCRIPTION)
74 #define GPF_DIRTY 0x01 // .pam file needs to be written on close
75 #define GPF_TRIED_READ_FAILED 0x02 // no need to keep trying to read .pam.
76 #define GPF_DISABLED 0x04 // do not try any PAM stuff.
77 #define GPF_AUXMODE 0x08 // store info in .aux (HFA) file.
78 #define GPF_NOSAVE 0x10 // do not try to save pam info.
88 class GDALDatasetPamInfo
91 char *pszPamFilename =
nullptr;
95 int bHaveGeoTransform =
false;
96 double adfGeoTransform[6]{0,0,0,0,0,0};
106 int bHasMetadata =
false;
117 std::map<CPLString, Statistics> oMapMDArrayStatistics{};
131 int IsPamFilenameAPotentialSiblingFile();
138 GDALDatasetPamInfo *psPam =
nullptr;
140 virtual const char *_GetProjectionRef()
override;
141 virtual const char *_GetGCPProjection()
override;
142 virtual CPLErr _SetProjection(
const char * pszProjection )
override;
143 virtual CPLErr _SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
144 const char *pszGCPProjection )
override;
146 virtual CPLXMLNode *SerializeToXML(
const char *);
149 virtual CPLErr TryLoadXML(
char **papszSiblingFiles =
nullptr);
150 virtual CPLErr TrySaveXML();
152 CPLErr TryLoadAux(
char **papszSiblingFiles =
nullptr);
155 void SerializeMDArrayStatistics(
CPLXMLNode* psDSTree);
157 virtual const char *BuildPamFilename();
159 void PamInitialize();
162 void SetPhysicalFilename(
const char * );
163 const char *GetPhysicalFilename();
164 void SetSubdatasetName(
const char *);
165 const char *GetSubdatasetName();
187 const char * pszDomain =
"" )
override;
189 const char * pszValue,
190 const char * pszDomain =
"" )
override;
191 char **
GetMetadata(
const char * pszDomain =
"" )
override;
193 const char * pszDomain =
"" )
override;
202 CPLErr IBuildOverviews(
const char *pszResampling,
203 int nOverviews,
int *panOverviewList,
204 int nListBands,
int *panBandList,
205 GDALProgressFunc pfnProgress,
206 void * pProgressData )
override;
208 bool GetMDArrayStatistics(
const char* pszMDArrayId,
210 double *pdfMin,
double *pdfMax,
211 double *pdfMean,
double *pdfStdDev,
214 void StoreMDArrayStatistics(
const char* pszMDArrayId,
216 double dfMin,
double dfMax,
217 double dfMean,
double dfStdDev,
221 void MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
222 GDALDatasetPamInfo *GetPamInfo() {
return psPam; }
223 int GetPamFlags() {
return nPamFlags; }
224 void SetPamFlags(
int nValue ) { nPamFlags = nValue; }
244 double dfNoDataValue;
251 char **papszCategoryNames;
270 } GDALRasterBandPamInfo;
283 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
286 void PamInitialize();
289 GDALRasterBandPamInfo *psPam =
nullptr;
317 double GetOffset(
int *pbSuccess =
nullptr )
override;
319 double GetScale(
int *pbSuccess =
nullptr )
override;
323 int nBuckets,
GUIntBig * panHistogram,
324 int bIncludeOutOfRange,
int bApproxOK,
325 GDALProgressFunc,
void *pProgressData )
override;
328 int *pnBuckets,
GUIntBig ** ppanHistogram,
330 GDALProgressFunc,
void *pProgressData)
override;
333 int nBuckets,
GUIntBig *panHistogram )
override;
336 const char * pszDomain =
"" )
override;
338 const char * pszValue,
339 const char * pszDomain =
"" )
override;
349 GDALRasterBandPamInfo *GetPamInfo() {
return psPam; }
357 int CPL_DLL PamParseHistogram(
CPLXMLNode *psHistItem,
358 double *pdfMin,
double *pdfMax,
359 int *pnBuckets,
GUIntBig **ppanHistogram,
360 int *pbIncludeOutOfRange,
int *pbApproxOK );
362 PamFindMatchingHistogram(
CPLXMLNode *psSavedHistograms,
363 double dfMin,
double dfMax,
int nBuckets,
364 int bIncludeOutOfRange,
int bApproxOK );
366 PamHistogramToXMLTree(
double dfMin,
double dfMax,
367 int nBuckets,
GUIntBig * panHistogram,
368 int bIncludeOutOfRange,
int bApprox );
371 const char CPL_DLL * PamGetProxy(
const char * );
372 const char CPL_DLL * PamAllocateProxy(
const char * );
373 const char CPL_DLL * PamDeallocateProxy(
const char * );
374 void CPL_DLL PamCleanProxyDB(
void );
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1674
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2050
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:269
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2627
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:1728
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2425
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2099
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:3469
PAM dataset.
Definition: gdal_pam.h:127
PAM raster band.
Definition: gdal_pam.h:278
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:5722
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:2675
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:1958
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1515
GDALColorInterp
Definition: gdal.h:194
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:120
Convenient string class based on std::string.
Definition: cpl_string.h:333
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:418
A single raster band (or channel).
Definition: gdal_priv.h:1112
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4128
Document node structure.
Definition: cpl_minixml.h:70
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:344
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1783
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1678
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:340
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:5869
virtual void ClearStatistics()
Clear statistics.
Definition: gdaldataset.cpp:8266
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1595
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1040
Ground Control Point.
Definition: gdal.h:669
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1500
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2580
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1615
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:909
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1213
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2943
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:5821
virtual double GetScale(int *pbSuccess=nullptr)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2531
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2003
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
CPLErr
Error category.
Definition: cpl_error.h:53
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
virtual CPLErr SetCategoryNames(char **papszNames)
Set the category names for this band.
Definition: gdalrasterband.cpp:1563
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:2927
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1158
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:48
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
virtual CPLErr SetOffset(double dfNewOffset)
Set scaling offset.
Definition: gdalrasterband.cpp:2474
#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:1007
A color table / palette.
Definition: gdal_priv.h:1006