30 #ifndef GDAL_PAM_H_INCLUDED
31 #define GDAL_PAM_H_INCLUDED
44 #define GCIF_GEOTRANSFORM 0x01
45 #define GCIF_PROJECTION 0x02
46 #define GCIF_METADATA 0x04
47 #define GCIF_GCPS 0x08
49 #define GCIF_NODATA 0x001000
50 #define GCIF_CATEGORYNAMES 0x002000
51 #define GCIF_MINMAX 0x004000
52 #define GCIF_SCALEOFFSET 0x008000
53 #define GCIF_UNITTYPE 0x010000
54 #define GCIF_COLORTABLE 0x020000
55 #define GCIF_COLORINTERP 0x020000
56 #define GCIF_BAND_METADATA 0x040000
57 #define GCIF_RAT 0x080000
58 #define GCIF_MASK 0x100000
59 #define GCIF_BAND_DESCRIPTION 0x200000
61 #define GCIF_ONLY_IF_MISSING 0x10000000
62 #define GCIF_PROCESS_BANDS 0x20000000
64 #define GCIF_PAM_DEFAULT (GCIF_GEOTRANSFORM | GCIF_PROJECTION | \
65 GCIF_METADATA | GCIF_GCPS | \
66 GCIF_NODATA | GCIF_CATEGORYNAMES | \
67 GCIF_MINMAX | GCIF_SCALEOFFSET | \
68 GCIF_UNITTYPE | GCIF_COLORTABLE | \
69 GCIF_COLORINTERP | GCIF_BAND_METADATA | \
70 GCIF_RAT | GCIF_MASK | \
71 GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS|\
72 GCIF_BAND_DESCRIPTION)
76 #define GPF_DIRTY 0x01 // .pam file needs to be written on close
77 #define GPF_TRIED_READ_FAILED 0x02 // no need to keep trying to read .pam.
78 #define GPF_DISABLED 0x04 // do not try any PAM stuff.
79 #define GPF_AUXMODE 0x08 // store info in .aux (HFA) file.
80 #define GPF_NOSAVE 0x10 // do not try to save pam info.
90 class GDALDatasetPamInfo
93 char *pszPamFilename =
nullptr;
95 std::vector<CPLXMLTreeCloser> m_apoOtherNodes{};
99 int bHaveGeoTransform =
false;
100 double adfGeoTransform[6]{0,0,0,0,0,0};
110 int bHasMetadata =
false;
124 int IsPamFilenameAPotentialSiblingFile();
131 GDALDatasetPamInfo *psPam =
nullptr;
133 virtual const char *_GetProjectionRef()
override;
134 virtual const char *_GetGCPProjection()
override;
135 virtual CPLErr _SetProjection(
const char * pszProjection )
override;
136 virtual CPLErr _SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
137 const char *pszGCPProjection )
override;
139 virtual CPLXMLNode *SerializeToXML(
const char *);
142 virtual CPLErr TryLoadXML(
char **papszSiblingFiles =
nullptr);
143 virtual CPLErr TrySaveXML();
145 CPLErr TryLoadAux(
char **papszSiblingFiles =
nullptr);
148 virtual const char *BuildPamFilename();
150 void PamInitialize();
153 void SetPhysicalFilename(
const char * );
154 const char *GetPhysicalFilename();
155 void SetSubdatasetName(
const char *);
156 const char *GetSubdatasetName();
178 const char * pszDomain =
"" )
override;
180 const char * pszValue,
181 const char * pszDomain =
"" )
override;
182 char **
GetMetadata(
const char * pszDomain =
"" )
override;
184 const char * pszDomain =
"" )
override;
193 CPLErr IBuildOverviews(
const char *pszResampling,
194 int nOverviews,
int *panOverviewList,
195 int nListBands,
int *panBandList,
196 GDALProgressFunc pfnProgress,
197 void * pProgressData )
override;
200 void MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
201 GDALDatasetPamInfo *GetPamInfo() {
return psPam; }
202 int GetPamFlags() {
return nPamFlags; }
203 void SetPamFlags(
int nValue ) { nPamFlags = nValue; }
223 double dfNoDataValue;
230 char **papszCategoryNames;
249 } GDALRasterBandPamInfo;
262 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
265 void PamInitialize();
268 GDALRasterBandPamInfo *psPam =
nullptr;
296 double GetOffset(
int *pbSuccess =
nullptr )
override;
298 double GetScale(
int *pbSuccess =
nullptr )
override;
302 int nBuckets,
GUIntBig * panHistogram,
303 int bIncludeOutOfRange,
int bApproxOK,
304 GDALProgressFunc,
void *pProgressData )
override;
307 int *pnBuckets,
GUIntBig ** ppanHistogram,
309 GDALProgressFunc,
void *pProgressData)
override;
312 int nBuckets,
GUIntBig *panHistogram )
override;
315 const char * pszDomain =
"" )
override;
317 const char * pszValue,
318 const char * pszDomain =
"" )
override;
328 GDALRasterBandPamInfo *GetPamInfo() {
return psPam; }
343 class CPL_DLL GDALPamMultiDim
346 std::unique_ptr<Private> d;
352 explicit GDALPamMultiDim(
const std::string& osFilename);
353 virtual ~GDALPamMultiDim();
355 std::shared_ptr<OGRSpatialReference> GetSpatialRef(
const std::string& osArrayFullName);
357 void SetSpatialRef(
const std::string& osArrayFullName,
360 CPLErr GetStatistics(
const std::string& osArrayFullName,
362 double *pdfMin,
double *pdfMax,
363 double *pdfMean,
double *pdfStdDev,
366 void SetStatistics(
const std::string& osArrayFullName,
368 double dfMin,
double dfMax,
369 double dfMean,
double dfStdDev,
372 void ClearStatistics();
374 void ClearStatistics(
const std::string& osArrayFullName );
384 std::shared_ptr<GDALPamMultiDim> m_poPam;
387 GDALPamMDArray(
const std::string& osParentName,
388 const std::string& osName,
389 const std::shared_ptr<GDALPamMultiDim>& poPam);
391 bool SetStatistics(
bool bApproxStats,
392 double dfMin,
double dfMax,
393 double dfMean,
double dfStdDev,
394 GUInt64 nValidCount )
override;
397 const std::shared_ptr<GDALPamMultiDim>& GetPAM()
const {
return m_poPam; }
400 double *pdfMin,
double *pdfMax,
401 double *pdfMean,
double *padfStdDev,
403 GDALProgressFunc pfnProgress,
void *pProgressData )
override;
409 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override;
413 int CPL_DLL PamParseHistogram(
CPLXMLNode *psHistItem,
414 double *pdfMin,
double *pdfMax,
415 int *pnBuckets,
GUIntBig **ppanHistogram,
416 int *pbIncludeOutOfRange,
int *pbApproxOK );
418 PamFindMatchingHistogram(
CPLXMLNode *psSavedHistograms,
419 double dfMin,
double dfMax,
int nBuckets,
420 int bIncludeOutOfRange,
int bApproxOK );
422 PamHistogramToXMLTree(
double dfMin,
double dfMax,
423 int nBuckets,
GUIntBig * panHistogram,
424 int bIncludeOutOfRange,
int bApprox );
427 const char CPL_DLL * PamGetProxy(
const char * );
428 const char CPL_DLL * PamAllocateProxy(
const char * );
429 const char CPL_DLL * PamDeallocateProxy(
const char * );
430 void CPL_DLL PamCleanProxyDB(
void );
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1684
virtual std::shared_ptr< OGRSpatialReference > GetSpatialRef() const
Return the spatial reference system object associated with the array.
Definition: gdalmultidim.cpp:2114
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2060
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:265
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2637
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:1738
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2435
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2109
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:3479
virtual CPLErr GetStatistics(bool bApproxOK, bool bForce, double *pdfMin, double *pdfMax, double *pdfMean, double *padfStdDev, GUInt64 *pnValidCount, GDALProgressFunc pfnProgress, void *pProgressData)
Fetch statistics.
Definition: gdalmultidim.cpp:7347
PAM dataset.
Definition: gdal_pam.h:119
PAM raster band.
Definition: gdal_pam.h:256
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:5725
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:2685
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:1968
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1525
GDALColorInterp
Definition: gdal.h:203
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:120
Convenient string class based on std::string.
Definition: cpl_string.h:332
A single raster band (or channel).
Definition: gdal_priv.h:1130
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4199
Document node structure.
Definition: cpl_minixml.h:69
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:1804
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1699
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:339
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2372
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:5872
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS)
Assign a spatial reference system object to the the array.
Definition: gdalmultidim.cpp:2100
virtual void ClearStatistics()
Clear statistics.
Definition: gdaldataset.cpp:8385
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:247
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1616
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1059
Ground Control Point.
Definition: gdal.h:710
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1519
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2590
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1625
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:928
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1232
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2996
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:5824
virtual void FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:435
virtual double GetScale(int *pbSuccess=nullptr)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2541
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2013
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
CPLErr
Error category.
Definition: cpl_error.h:52
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:1573
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:2937
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1177
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
Definition: gdal_rat.h:47
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:2484
#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:955
A color table / palette.
Definition: gdal_priv.h:1022
virtual void ClearStatistics()
Clear statistics.
Definition: gdalmultidim.cpp:7588