31 #ifndef VIRTUALDATASET_H_INCLUDED
32 #define VIRTUALDATASET_H_INCLUDED
51 CPLErr GDALRegisterDefaultPixelFunc();
54 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
56 double *padfX,
double *padfY,
double *padfZ,
58 void* VRTDeserializeWarpedOverviewTransformer(
CPLXMLNode *psTree );
72 int bTriedToOpen = FALSE;
74 VRTOverviewInfo() =
default;
75 VRTOverviewInfo(VRTOverviewInfo&& oOther) noexcept:
76 osFilename(std::move(oOther.osFilename)),
78 poBand(oOther.poBand),
79 bTriedToOpen(oOther.bTriedToOpen)
81 oOther.poBand =
nullptr;
90 if( poBand ==
nullptr )
109 class CPL_DLL VRTSource
112 virtual ~VRTSource();
115 int nXOff,
int nYOff,
int nXSize,
int nYSize,
116 void *pData,
int nBufXSize,
int nBufYSize,
121 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
122 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
123 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
124 double dfMin,
double dfMax,
125 int nBuckets,
GUIntBig * panHistogram,
126 int bIncludeOutOfRange,
int bApproxOK,
127 GDALProgressFunc pfnProgress,
128 void *pProgressData ) = 0;
131 std::map<CPLString, GDALDataset*>& ) = 0;
132 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
134 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
137 virtual int IsSimpleSource() {
return FALSE; }
138 virtual CPLErr FlushCache(
bool ) {
return CE_None; }
141 typedef VRTSource *(*VRTSourceParser)(
CPLXMLNode *,
const char *,
142 std::map<CPLString, GDALDataset*>& oMapSharedSources);
144 VRTSource *VRTParseCoreSources(
CPLXMLNode *psTree,
const char *,
145 std::map<CPLString, GDALDataset*>& oMapSharedSources);
146 VRTSource *VRTParseFilterSources(
CPLXMLNode *psTree,
const char *,
147 std::map<CPLString, GDALDataset*>& oMapSharedSources );
155 template<
class T>
struct VRTFlushCacheStruct
157 static void FlushCache(T& obj,
bool bAtClosing);
160 class VRTWarpedDataset;
161 class VRTPansharpenedDataset;
166 friend class VRTRasterBand;
167 friend struct VRTFlushCacheStruct<VRTDataset>;
168 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
169 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
170 friend class VRTSourcedRasterBand;
175 int m_bGeoTransformSet =
false;
176 double m_adfGeoTransform[6];
182 bool m_bNeedsFlush =
false;
183 bool m_bWritable =
true;
184 bool m_bCanTakeRef =
true;
186 char *m_pszVRTPath =
nullptr;
188 VRTRasterBand *m_poMaskBand =
nullptr;
190 int m_bCompatibleForDatasetIO = -1;
191 int CheckCompatibleForDatasetIO();
195 std::vector<GDALDataset*> m_apoOverviews{};
196 std::vector<GDALDataset*> m_apoOverviewsBak{};
198 std::vector<int> m_anOverviewFactors{};
200 char **m_papszXMLVRTMetadata =
nullptr;
202 std::map<CPLString, GDALDataset*> m_oMapSharedSources{};
203 std::shared_ptr<VRTGroup> m_poRootGroup{};
205 VRTRasterBand* InitBand(
const char* pszSubclass,
int nBand,
206 bool bAllowPansharpened);
207 static GDALDataset *OpenVRTProtocol(
const char* pszSpec );
208 bool AddVirtualOverview(
int nOvFactor,
209 const char* pszResampling);
217 VRTDataset(
int nXSize,
int nYSize);
218 virtual ~VRTDataset();
220 void SetNeedsFlush() { m_bNeedsFlush =
true; }
221 virtual void FlushCache(
bool bAtClosing)
override;
223 void SetWritable(
int bWritableIn) { m_bWritable = CPL_TO_BOOL(bWritableIn); }
226 void SetMaskBand(VRTRasterBand* poMaskBand);
235 const char *pszDomain =
"" )
override;
237 const char *pszDomain =
"" )
override;
239 virtual char**
GetMetadata(
const char *pszDomain =
"" )
override;
249 char **papszOptions=
nullptr )
override;
254 int nXOff,
int nYOff,
int nXSize,
int nYSize,
255 void * pData,
int nBufXSize,
int nBufYSize,
257 int nBandCount,
int *panBandMap,
263 int nBufXSize,
int nBufYSize,
265 int nBandCount,
int *panBandList,
266 char **papszOptions )
override;
268 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
271 virtual CPLErr IBuildOverviews(
const char *,
274 GDALProgressFunc,
void *,
277 std::shared_ptr<GDALGroup>
GetRootGroup()
const override;
281 void BuildVirtualOverviews();
283 void UnsetPreservedRelativeFilenames();
287 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
290 int nXSize,
int nYSize,
int nBands,
292 static GDALDataset *CreateMultiDimensional(
const char * pszFilename,
295 static CPLErr Delete(
const char * pszFilename );
303 class VRTWarpedRasterBand;
305 class CPL_DLL VRTWarpedDataset final:
public VRTDataset
311 int m_nOverviewCount;
312 VRTWarpedDataset **m_papoOverviews;
315 void CreateImplicitOverviews();
317 friend class VRTWarpedRasterBand;
322 virtual int CloseDependentDatasets()
override;
325 VRTWarpedDataset(
int nXSize,
int nYSize );
326 virtual ~VRTWarpedDataset();
328 virtual void FlushCache(
bool bAtClosing)
override;
330 CPLErr Initialize(
void * );
332 virtual CPLErr IBuildOverviews(
const char *,
335 GDALProgressFunc,
void *,
338 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
339 const char *pszDomain =
"" )
override;
341 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
345 char **papszOptions=
nullptr )
override;
347 virtual char **GetFileList()
override;
349 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
351 void GetBlockSize(
int *,
int * )
const;
363 GTAdjust_Intersection,
365 GTAdjust_NoneWithoutWarning
368 class VRTPansharpenedDataset final:
public VRTDataset
370 friend class VRTPansharpenedRasterBand;
375 VRTPansharpenedDataset* m_poMainDataset;
376 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets{};
378 std::map<CPLString,CPLString> m_oMapToRelativeFilenames{};
380 int m_bLoadingOtherBands;
382 GByte *m_pabyLastBufferBandRasterIO;
383 int m_nLastBandRasterIOXOff;
384 int m_nLastBandRasterIOYOff;
385 int m_nLastBandRasterIOXSize;
386 int m_nLastBandRasterIOYSize;
389 GTAdjustment m_eGTAdjustment;
390 int m_bNoDataDisabled;
392 std::vector<GDALDataset*> m_apoDatasetsToClose{};
397 virtual int CloseDependentDatasets()
override;
400 VRTPansharpenedDataset(
int nXSize,
int nYSize );
401 virtual ~VRTPansharpenedDataset();
403 virtual void FlushCache(
bool bAtClosing)
override;
406 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
410 int nInputSpectralBandsIn,
414 char **papszOptions=
nullptr )
override;
416 virtual char **GetFileList()
override;
419 int nXOff,
int nYOff,
int nXSize,
int nYSize,
420 void * pData,
int nBufXSize,
int nBufYSize,
422 int nBandCount,
int *panBandMap,
427 void GetBlockSize(
int *,
int * )
const;
439 constexpr
double VRT_DEFAULT_NODATA_VALUE = -10000.0;
445 void ResetNoDataValues();
448 friend class VRTDataset;
450 int m_bIsMaskBand = FALSE;
452 int m_bNoDataValueSet = FALSE;
454 int m_bHideNoDataValue = FALSE;
455 double m_dfNoDataValue = VRT_DEFAULT_NODATA_VALUE;
457 bool m_bNoDataSetAsInt64 =
false;
458 int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
460 bool m_bNoDataSetAsUInt64 =
false;
461 uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
463 std::unique_ptr<GDALColorTable> m_poColorTable{};
467 char *m_pszUnitType =
nullptr;
468 char **m_papszCategoryNames =
nullptr;
470 double m_dfOffset = 0.0;
471 double m_dfScale = 1.0;
475 void Initialize(
int nXSize,
int nYSize );
477 std::vector<VRTOverviewInfo> m_aoOverviewInfos{};
479 VRTRasterBand *m_poMaskBand =
nullptr;
481 std::unique_ptr<GDALRasterAttributeTable> m_poRAT{};
485 bool IsNoDataValueInDataTypeRange()
const;
490 virtual ~VRTRasterBand();
493 std::map<CPLString, GDALDataset*>& );
494 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
519 virtual CPLErr SetMetadata(
char **papszMD,
const char *pszDomain =
"" )
override;
521 const char *pszDomain =
"" )
override;
523 virtual double GetOffset(
int *pbSuccess =
nullptr )
override;
525 virtual double GetScale(
int *pbSuccess =
nullptr )
override;
532 int nBuckets,
GUIntBig * panHistogram,
533 int bIncludeOutOfRange,
int bApproxOK,
534 GDALProgressFunc,
void *pProgressData )
override;
537 int *pnBuckets,
GUIntBig ** ppanHistogram,
539 GDALProgressFunc,
void *pProgressData)
override;
542 int nBuckets,
GUIntBig *panHistogram )
override;
546 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
556 void SetMaskBand(VRTRasterBand* poMaskBand);
558 void SetIsMaskBand();
562 CPLErr UnsetNoDataValue();
564 virtual int CloseDependentDatasets();
566 virtual int IsSourcedRasterBand() {
return FALSE; }
567 virtual int IsPansharpenRasterBand() {
return FALSE; }
574 class VRTSimpleSource;
576 class CPL_DLL VRTSourcedRasterBand
CPL_NON_FINAL:
public VRTRasterBand
580 char **m_papszSourceList =
nullptr;
581 int m_nSkipBufferInitialization = -1;
583 bool CanUseSourcesMinMaxImplementations();
585 bool IsMosaicOfNonOverlappingSimpleSourcesOfFullRasterNoResAndTypeChange(
bool bAllowMaxValAdjustment)
const;
590 bool SkipBufferInitialization();
594 VRTSource **papoSources =
nullptr;
596 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand );
598 int nXSize,
int nYSize );
599 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
601 int nXSize,
int nYSize );
602 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
604 int nXSize,
int nYSize,
605 int nBlockXSizeIn,
int nBlockYSizeIn );
606 virtual ~VRTSourcedRasterBand();
613 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
614 int nXSize,
int nYSize,
616 double* pdfDataPct)
override;
618 virtual char **GetMetadataDomainList()
override;
619 virtual const char *GetMetadataItem(
const char * pszName,
620 const char * pszDomain =
"" )
override;
621 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
622 virtual CPLErr SetMetadata(
char ** papszMetadata,
623 const char * pszDomain =
"" )
override;
624 virtual CPLErr SetMetadataItem(
const char * pszName,
625 const char * pszValue,
626 const char * pszDomain =
"" )
override;
629 std::map<CPLString, GDALDataset*>& )
override;
630 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
632 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
633 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
634 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
635 virtual CPLErr ComputeStatistics(
int bApproxOK,
636 double *pdfMin,
double *pdfMax,
637 double *pdfMean,
double *pdfStdDev,
638 GDALProgressFunc pfnProgress,
639 void *pProgressData )
override;
640 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
641 int nBuckets,
GUIntBig * panHistogram,
642 int bIncludeOutOfRange,
int bApproxOK,
643 GDALProgressFunc pfnProgress,
644 void *pProgressData )
override;
646 CPLErr AddSource( VRTSource * );
648 CPLErr AddSimpleSource(
const char* pszFilename,
650 double dfSrcXOff=-1,
double dfSrcYOff=-1,
651 double dfSrcXSize=-1,
double dfSrcYSize=-1,
652 double dfDstXOff=-1,
double dfDstYOff=-1,
653 double dfDstXSize=-1,
double dfDstYSize=-1,
654 const char *pszResampling =
"near",
658 double dfSrcXOff=-1,
double dfSrcYOff=-1,
659 double dfSrcXSize=-1,
double dfSrcYSize=-1,
660 double dfDstXOff=-1,
double dfDstYOff=-1,
661 double dfDstXSize=-1,
double dfDstYSize=-1,
662 const char *pszResampling =
"near",
665 CPLErr AddComplexSource(
const char* pszFilename,
667 double dfSrcXOff=-1,
double dfSrcYOff=-1,
668 double dfSrcXSize=-1,
double dfSrcYSize=-1,
669 double dfDstXOff=-1,
double dfDstYOff=-1,
670 double dfDstXSize=-1,
double dfDstYSize=-1,
671 double dfScaleOff=0.0,
672 double dfScaleRatio=1.0,
674 int nColorTableComponent = 0);
677 double dfSrcXOff=-1,
double dfSrcYOff=-1,
678 double dfSrcXSize=-1,
double dfSrcYSize=-1,
679 double dfDstXOff=-1,
double dfDstYOff=-1,
680 double dfDstXSize=-1,
double dfDstYSize=-1,
681 double dfScaleOff=0.0,
682 double dfScaleRatio=1.0,
684 int nColorTableComponent = 0);
687 double dfSrcXOff=-1,
double dfSrcYOff=-1,
688 double dfSrcXSize=-1,
689 double dfSrcYSize=-1,
690 double dfDstXOff=-1,
double dfDstYOff=-1,
691 double dfDstXSize=-1,
692 double dfDstYSize=-1 );
697 void ConfigureSource(VRTSimpleSource *poSimpleSource,
700 double dfSrcXOff,
double dfSrcYOff,
701 double dfSrcXSize,
double dfSrcYSize,
702 double dfDstXOff,
double dfDstYOff,
703 double dfDstXSize,
double dfDstYSize );
705 void RemoveCoveredSources(
CSLConstList papszOptions =
nullptr);
707 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
709 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
710 int *pnMaxSize,
CPLHashSet* hSetFiles)
override;
712 virtual int CloseDependentDatasets()
override;
714 virtual int IsSourcedRasterBand()
override {
return TRUE; }
716 virtual CPLErr FlushCache(
bool bAtClosing)
override;
723 class CPL_DLL VRTWarpedRasterBand final:
public VRTRasterBand
728 virtual ~VRTWarpedRasterBand();
730 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
732 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
733 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
735 virtual int GetOverviewCount()
override;
742 class VRTPansharpenedRasterBand final:
public VRTRasterBand
744 int m_nIndexAsPansharpenedBand;
747 VRTPansharpenedRasterBand(
750 virtual ~VRTPansharpenedRasterBand();
752 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
754 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
757 int nXOff,
int nYOff,
int nXSize,
int nYSize,
758 void * pData,
int nBufXSize,
int nBufYSize,
763 virtual int GetOverviewCount()
override;
766 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
768 void SetIndexAsPansharpenedBand(
int nIdx )
769 { m_nIndexAsPansharpenedBand = nIdx; }
770 int GetIndexAsPansharpenedBand()
const
771 {
return m_nIndexAsPansharpenedBand; }
778 class VRTDerivedRasterBandPrivateData;
780 class CPL_DLL VRTDerivedRasterBand
CPL_NON_FINAL:
public VRTSourcedRasterBand
782 VRTDerivedRasterBandPrivateData* m_poPrivate;
783 bool InitializePython();
784 CPLErr GetPixelFunctionArguments(
786 std::vector<std::pair<CPLString, CPLString>> &);
796 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand );
797 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand,
799 virtual ~VRTDerivedRasterBand();
806 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
807 int nXSize,
int nYSize,
809 double* pdfDataPct)
override;
811 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
813 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
815 const char *pszMetadata);
817 static std::pair<PixelFunc, CPLString>* GetPixelFunction(
const char *pszFuncNameIn );
819 void SetPixelFunctionName(
const char *pszFuncNameIn );
821 void SetPixelFunctionLanguage(
const char* pszLanguage );
824 std::map<CPLString, GDALDataset*>& )
override;
825 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
827 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
828 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
829 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
830 virtual CPLErr ComputeStatistics(
int bApproxOK,
831 double *pdfMin,
double *pdfMax,
832 double *pdfMean,
double *pdfStdDev,
833 GDALProgressFunc pfnProgress,
834 void *pProgressData )
override;
835 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
836 int nBuckets,
GUIntBig * panHistogram,
837 int bIncludeOutOfRange,
int bApproxOK,
838 GDALProgressFunc pfnProgress,
839 void *pProgressData )
override;
841 static void Cleanup();
850 class CPL_DLL VRTRawRasterBand
CPL_NON_FINAL:
public VRTRasterBand
852 RawRasterBand *m_poRawRaster;
854 char *m_pszSourceFilename;
855 int m_bRelativeToVRT;
862 virtual ~VRTRawRasterBand();
865 std::map<CPLString, GDALDataset*>& )
override;
866 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
873 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
874 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
876 CPLErr SetRawLink(
const char *pszFilename,
877 const char *pszVRTPath,
880 int nPixelOffset,
int nLineOffset,
881 const char *pszByteOrder );
888 char **papszOptions )
override;
890 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
891 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
902 std::map<std::string, VRTSourceParser> m_oMapSourceParser{};
906 virtual ~VRTDriver();
908 char **papszSourceParsers;
911 virtual char **
GetMetadata(
const char * pszDomain =
"" )
override;
913 const char * pszDomain =
"" )
override;
915 VRTSource *ParseSource(
CPLXMLNode *psSrc,
const char *pszVRTPath,
916 std::map<CPLString, GDALDataset*>& oMapSharedSources );
917 void AddSourceParser(
const char *pszElementName,
918 VRTSourceParser pfnParser );
925 class CPL_DLL VRTSimpleSource
CPL_NON_FINAL:
public VRTSource
931 std::map<CPLString, GDALDataset*>* m_poMapSharedSources =
nullptr;
941 void OpenSource()
const;
944 friend class VRTSourcedRasterBand;
945 friend class VRTDataset;
948 bool m_bGetMaskBand =
false;
950 double m_dfSrcXOff = 0;
951 double m_dfSrcYOff = 0;
952 double m_dfSrcXSize = 0;
953 double m_dfSrcYSize = 0;
955 double m_dfDstXOff = 0;
956 double m_dfDstYOff = 0;
957 double m_dfDstXSize = 0;
958 double m_dfDstYSize = 0;
964 int m_bRelativeToVRTOri = -1;
966 int m_nExplicitSharedStatus = -1;
969 bool m_bDropRefOnSrcBand =
true;
971 int NeedMaxValAdjustment()
const;
973 GDALRasterBand* GetRasterBandNoOpen()
const {
return m_poRasterBand; }
975 virtual bool ValidateOpenedBand(
GDALRasterBand* )
const {
return true; }
979 VRTSimpleSource(
const VRTSimpleSource* poSrcSource,
980 double dfXDstRatio,
double dfYDstRatio );
981 virtual ~VRTSimpleSource();
984 std::map<CPLString, GDALDataset*>& )
override;
985 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
987 void SetSrcBand(
const char* pszFilename,
int nBand );
990 void SetSrcWindow(
double,
double,
double,
double );
991 void SetDstWindow(
double,
double,
double,
double );
992 const CPLString& GetResampling()
const {
return m_osResampling; }
993 void SetResampling(
const char* pszResampling );
995 int GetSrcDstWindow(
double,
double,
double,
double,
997 double *pdfReqXOff,
double *pdfReqYOff,
998 double *pdfReqXSize,
double *pdfReqYSize,
999 int *,
int *,
int *,
int *,
1000 int *,
int *,
int *,
int *,
1004 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1005 void *pData,
int nBufXSize,
int nBufYSize,
1010 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1011 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1012 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1013 double dfMin,
double dfMax,
1014 int nBuckets,
GUIntBig * panHistogram,
1015 int bIncludeOutOfRange,
int bApproxOK,
1016 GDALProgressFunc pfnProgress,
1017 void *pProgressData )
override;
1019 void DstToSrc(
double dfX,
double dfY,
1020 double &dfXOut,
double &dfYOut )
const;
1021 void SrcToDst(
double dfX,
double dfY,
1022 double &dfXOut,
double &dfYOut )
const;
1024 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
1025 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
1027 virtual int IsSimpleSource()
override {
return TRUE; }
1028 virtual const char* GetType() {
return "SimpleSource"; }
1029 virtual CPLErr FlushCache(
bool bAtClosing)
override;
1033 int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
1036 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1037 void * pData,
int nBufXSize,
int nBufYSize,
1039 int nBandCount,
int *panBandMap,
1044 void UnsetPreservedRelativeFilenames();
1046 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
1053 class VRTAveragedSource final:
public VRTSimpleSource
1057 int m_bNoDataSet =
false;
1061 VRTAveragedSource();
1063 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1064 void *pData,
int nBufXSize,
int nBufYSize,
1069 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1070 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1071 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1072 double dfMin,
double dfMax,
1073 int nBuckets,
GUIntBig * panHistogram,
1074 int bIncludeOutOfRange,
int bApproxOK,
1075 GDALProgressFunc pfnProgress,
1076 void *pProgressData )
override;
1078 void SetNoDataValue(
double dfNoDataValue );
1080 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1081 virtual const char* GetType()
override {
return "AveragedSource"; }
1092 VRT_SCALING_EXPONENTIAL,
1093 } VRTComplexSourceScaling;
1095 class CPL_DLL VRTComplexSource
CPL_NON_FINAL:
public VRTSimpleSource
1101 int m_bNoDataSet =
false;
1104 std::string m_osNoDataValueOri{};
1106 VRTComplexSourceScaling m_eScalingType = VRT_SCALING_NONE;
1107 double m_dfScaleOff = 0;
1108 double m_dfScaleRatio = 1;
1111 int m_bSrcMinMaxDefined = FALSE;
1112 double m_dfSrcMin = 0;
1113 double m_dfSrcMax = 0;
1114 double m_dfDstMin = 0;
1115 double m_dfDstMax = 0;
1116 double m_dfExponent = 1;
1118 int m_nColorTableComponent = 0;
1120 bool m_bUseMaskBand =
false;
1122 double *m_padfLUTInputs =
nullptr;
1123 double *m_padfLUTOutputs =
nullptr;
1124 int m_nLUTItemCount = 0;
1126 double GetAdjustedNoDataValue()
const;
1128 template <
class WorkingDT>
1129 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
1130 int nReqXSize,
int nReqYSize,
1131 void *pData,
int nOutXSize,
int nOutYSize,
1139 VRTComplexSource(
const VRTComplexSource* poSrcSource,
1140 double dfXDstRatio,
double dfYDstRatio);
1141 virtual ~VRTComplexSource();
1144 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1145 void *pData,
int nBufXSize,
int nBufYSize,
1150 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1151 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1152 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1153 double dfMin,
double dfMax,
1154 int nBuckets,
GUIntBig * panHistogram,
1155 int bIncludeOutOfRange,
int bApproxOK,
1156 GDALProgressFunc pfnProgress,
1157 void *pProgressData )
override;
1159 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1161 std::map<CPLString, GDALDataset*>& )
override;
1162 virtual const char* GetType()
override {
return "ComplexSource"; }
1164 bool AreValuesUnchanged()
const;
1166 double LookupValue(
double dfInput );
1168 void SetNoDataValue(
double dfNoDataValue );
1170 void SetUseMaskBand(
bool bUseMaskBand) { m_bUseMaskBand = bUseMaskBand; }
1172 void SetLinearScaling(
double dfOffset,
double dfScale );
1173 void SetPowerScaling(
double dfExponent,
1178 void SetColorTableComponent(
int nComponent );
1185 class VRTFilteredSource
CPL_NON_FINAL:
public VRTComplexSource
1193 int m_nSupportedTypesCount;
1196 int m_nExtraEdgePixels;
1199 VRTFilteredSource();
1200 virtual ~VRTFilteredSource();
1202 void SetExtraEdgePixels(
int );
1203 void SetFilteringDataTypesSupported(
int,
GDALDataType * );
1206 GByte *pabySrcData,
GByte *pabyDstData ) = 0;
1209 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1210 void *pData,
int nBufXSize,
int nBufYSize,
1220 class VRTKernelFilteredSource
CPL_NON_FINAL:
public VRTFilteredSource
1229 double *m_padfKernelCoefs;
1234 VRTKernelFilteredSource();
1235 virtual ~VRTKernelFilteredSource();
1238 std::map<CPLString, GDALDataset*>& )
override;
1239 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1242 GByte *pabySrcData,
GByte *pabyDstData )
override;
1244 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1245 void SetNormalized(
int );
1252 class VRTAverageFilteredSource final:
public VRTKernelFilteredSource
1257 explicit VRTAverageFilteredSource(
int nKernelSize );
1258 virtual ~VRTAverageFilteredSource();
1261 std::map<CPLString, GDALDataset*>& )
override;
1262 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1268 class VRTFuncSource final:
public VRTSource
1274 virtual ~VRTFuncSource();
1277 std::map<CPLString, GDALDataset*>& )
override {
return CE_Failure; }
1278 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1281 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1282 void *pData,
int nBufXSize,
int nBufYSize,
1287 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1288 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1289 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1290 double dfMin,
double dfMax,
1291 int nBuckets,
GUIntBig * panHistogram,
1292 int bIncludeOutOfRange,
int bApproxOK,
1293 GDALProgressFunc pfnProgress,
1294 void *pProgressData )
override;
1308 #define TMP_CPL_DLL CPL_DLL
1323 explicit Ref(VRTGroup* ptr): m_ptr(ptr) {}
1324 Ref(
const Ref&) =
delete;
1325 Ref& operator=(
const Ref&) =
delete;
1329 std::shared_ptr<Ref> m_poSharedRefRootGroup{};
1330 std::weak_ptr<Ref> m_poWeakRefRootGroup{};
1331 std::shared_ptr<Ref> m_poRefSelf{};
1333 std::string m_osFilename{};
1334 mutable bool m_bDirty =
false;
1335 std::string m_osVRTPath{};
1336 std::map<std::string, std::shared_ptr<VRTGroup>> m_oMapGroups{};
1337 std::map<std::string, std::shared_ptr<VRTMDArray>> m_oMapMDArrays{};
1338 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1339 std::map<std::string, std::shared_ptr<VRTDimension>> m_oMapDimensions{};
1341 std::shared_ptr<VRTGroup> OpenGroupInternal(
const std::string& osName)
const;
1342 void SetRootGroupRef(
const std::weak_ptr<Ref>& rgRef);
1343 std::weak_ptr<Ref> GetRootGroupRef()
const;
1347 VRTGroup(
const std::string& osParentName,
const std::string& osName);
1350 bool XMLInit(
const std::shared_ptr<VRTGroup>& poRoot,
1351 const std::shared_ptr<VRTGroup>& poThisGroup,
1353 const char* pszVRTPath);
1356 std::shared_ptr<GDALMDArray>
OpenMDArray(
const std::string& osName,
1360 std::shared_ptr<GDALGroup>
OpenGroup(
const std::string& osName,
1363 return OpenGroupInternal(osName);
1370 std::shared_ptr<VRTDimension> GetDimension(
const std::string& name)
const {
1371 auto oIter = m_oMapDimensions.find(name);
1372 return oIter == m_oMapDimensions.end() ? nullptr : oIter->second;
1374 std::shared_ptr<VRTDimension> GetDimensionFromFullName(
const std::string& name,
1375 bool bEmitError)
const;
1377 std::shared_ptr<GDALGroup>
CreateGroup(
const std::string& osName,
1380 std::shared_ptr<GDALDimension>
CreateDimension(
const std::string& osName,
1381 const std::string& osType,
1382 const std::string& osDirection,
1387 const std::string& osName,
1388 const std::vector<GUInt64>& anDimensions,
1392 std::shared_ptr<GDALMDArray>
CreateMDArray(
const std::string& osName,
1393 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
1397 void SetIsRootGroup();
1399 const std::shared_ptr<Ref>& GetRef()
const {
return m_poRefSelf; }
1400 VRTGroup* GetRootGroup()
const;
1402 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1404 void SetFilename(
const std::string& osFilename) { m_osFilename = osFilename; }
1405 const std::string& GetFilename()
const {
return m_osFilename; }
1406 void Serialize()
const;
1407 CPLXMLNode* SerializeToXML(
const char *pszVRTPathIn )
const;
1408 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn)
const;
1417 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1418 std::string m_osIndexingVariableName;
1421 VRTDimension(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1422 const std::string& osParentName,
1423 const std::string& osName,
1424 const std::string& osType,
1425 const std::string& osDirection,
1427 const std::string& osIndexingVariableName):
1428 GDALDimension(osParentName, osName, osType, osDirection, nSize),
1429 m_poGroupRef(poGroupRef),
1430 m_osIndexingVariableName(osIndexingVariableName)
1433 VRTGroup* GetGroup()
const;
1435 static std::shared_ptr<VRTDimension> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1436 const std::string& osParentName,
1453 std::vector<std::string> m_aosList{};
1454 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
1458 bool IRead(
const GUInt64* arrayStartIdx,
1459 const size_t* count,
1463 void* pDstBuffer)
const override;
1465 bool IWrite(
const GUInt64* arrayStartIdx,
1466 const size_t* count,
1470 const void* pSrcBuffer)
override;
1474 VRTAttribute(
const std::string& osParentName,
1475 const std::string& osName,
1477 std::vector<std::string>&& aosList):
1481 m_aosList(std::move(aosList))
1483 if( m_aosList.size() > 1 )
1485 m_dims.emplace_back(std::make_shared<GDALDimension>(
1486 std::string(),
"dim",
1487 std::string(), std::string(), m_aosList.size()));
1491 VRTAttribute(
const std::string& osParentName,
1492 const std::string& osName,
1501 m_dims.emplace_back(std::make_shared<GDALDimension>(
1502 std::string(),
"dim",
1503 std::string(), std::string(), nDim));
1507 static bool CreationCommonChecks(
const std::string& osName,
1508 const std::vector<GUInt64>& anDimensions,
1509 const std::map<std::string, std::shared_ptr<VRTAttribute>>& oMapAttributes);
1511 static std::shared_ptr<VRTAttribute> Create(
const std::string& osParentName,
1514 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1525 class VRTMDArraySource
1528 virtual ~VRTMDArraySource() =
default;
1530 virtual bool Read(
const GUInt64* arrayStartIdx,
1531 const size_t* count,
1535 void* pDstBuffer)
const = 0;
1537 virtual void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const = 0;
1547 friend class VRTGroup;
1549 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1550 std::string m_osVRTPath{};
1553 std::vector<std::shared_ptr<GDALDimension>> m_dims;
1554 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1555 std::vector<std::unique_ptr<VRTMDArraySource>> m_sources{};
1556 std::shared_ptr<OGRSpatialReference> m_poSRS{};
1557 std::vector<GByte> m_abyNoData{};
1558 std::string m_osUnit{};
1559 double m_dfScale = 1.0;
1560 double m_dfOffset = 0.0;
1561 bool m_bHasScale =
false;
1562 bool m_bHasOffset =
false;
1563 std::string m_osFilename{};
1565 bool IRead(
const GUInt64* arrayStartIdx,
1566 const size_t* count,
1570 void* pDstBuffer)
const override;
1575 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1576 const std::string& osParentName,
1577 const std::string& osName,
1579 std::vector<std::shared_ptr<GDALDimension>>&& dims,
1580 std::map<std::string, std::shared_ptr<VRTAttribute>>&& oMapAttributes) :
1583 m_poGroupRef(poGroupRef),
1584 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1586 m_dims(std::move(dims)),
1587 m_oMapAttributes(std::move(oMapAttributes)),
1588 m_osFilename(poGroupRef->m_ptr->GetFilename())
1592 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1593 const std::string& osParentName,
1594 const std::string& osName,
1595 const std::vector<std::shared_ptr<GDALDimension>>& dims,
1599 m_poGroupRef(poGroupRef),
1600 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1603 m_osFilename(poGroupRef->m_ptr->GetFilename())
1607 bool IsWritable()
const override {
return false; }
1609 const std::string&
GetFilename()
const override {
return m_osFilename; }
1611 static std::shared_ptr<VRTMDArray> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1612 const std::string& osParentName,
1615 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1623 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override {
return m_poSRS; }
1629 const std::string&
GetUnit()
const override {
return m_osUnit; }
1631 bool SetUnit(
const std::string& osUnit)
override {
1632 m_osUnit = osUnit;
return true; }
1636 if( pbHasOffset) *pbHasOffset = m_bHasOffset;
1643 if( pbHasScale) *pbHasScale = m_bHasScale;
1649 { SetDirty(); m_bHasOffset =
true; m_dfOffset = dfOffset;
return true; }
1652 { SetDirty(); m_bHasScale =
true; m_dfScale = dfScale;
return true; }
1654 void AddSource(std::unique_ptr<VRTMDArraySource>&& poSource);
1657 const std::string& osName,
1658 const std::vector<GUInt64>& anDimensions,
1667 GDALProgressFunc pfnProgress,
1668 void * pProgressData)
override;
1670 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn )
const;
1672 VRTGroup* GetGroup()
const;
1674 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1681 class VRTMDArraySourceInlinedValues final:
public VRTMDArraySource
1683 const VRTMDArray* m_poDstArray =
nullptr;
1684 bool m_bIsConstantValue;
1685 std::vector<GUInt64> m_anOffset{};
1686 std::vector<size_t> m_anCount{};
1687 std::vector<GByte> m_abyValues{};
1688 std::vector<size_t> m_anInlinedArrayStrideInBytes{};
1691 VRTMDArraySourceInlinedValues(
const VRTMDArraySourceInlinedValues&) =
delete;
1692 VRTMDArraySourceInlinedValues& operator=(
const VRTMDArraySourceInlinedValues&) =
delete;
1695 VRTMDArraySourceInlinedValues(
const VRTMDArray* poDstArray,
1696 bool bIsConstantValue,
1697 std::vector<GUInt64>&& anOffset,
1698 std::vector<size_t>&& anCount,
1699 std::vector<GByte>&& abyValues):
1700 m_poDstArray(poDstArray),
1701 m_bIsConstantValue(bIsConstantValue),
1702 m_anOffset(std::move(anOffset)),
1703 m_anCount(std::move(anCount)),
1704 m_abyValues(std::move(abyValues)),
1705 m_dt(poDstArray->GetDataType())
1707 const auto nDims(poDstArray->GetDimensionCount());
1708 m_anInlinedArrayStrideInBytes.resize(nDims);
1709 if( !bIsConstantValue && nDims > 0 )
1711 m_anInlinedArrayStrideInBytes.back() = poDstArray->GetDataType().GetSize();
1712 for(
size_t i = nDims - 1; i > 0; )
1715 m_anInlinedArrayStrideInBytes[i] =
1716 m_anInlinedArrayStrideInBytes[i+1] * m_anCount[i+1];
1721 ~VRTMDArraySourceInlinedValues();
1723 static std::unique_ptr<VRTMDArraySourceInlinedValues> Create(
1724 const VRTMDArray* poDstArray,
1727 bool Read(
const GUInt64* arrayStartIdx,
1728 const size_t* count,
1732 void* pDstBuffer)
const override;
1734 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1741 class VRTMDArraySourceRegularlySpaced final:
public VRTMDArraySource
1744 double m_dfIncrement;
1747 VRTMDArraySourceRegularlySpaced(
1748 double dfStart,
double dfIncrement):
1750 m_dfIncrement(dfIncrement)
1754 bool Read(
const GUInt64* arrayStartIdx,
1755 const size_t* count,
1759 void* pDstBuffer)
const override;
1761 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1768 class VRTMDArraySourceFromArray final:
public VRTMDArraySource
1770 const VRTMDArray* m_poDstArray =
nullptr;
1771 bool m_bRelativeToVRTSet =
false;
1772 bool m_bRelativeToVRT =
false;
1773 std::string m_osFilename{};
1774 std::string m_osArray{};
1775 std::string m_osBand{};
1776 std::vector<int> m_anTransposedAxis{};
1777 std::string m_osViewExpr{};
1778 std::vector<GUInt64> m_anSrcOffset{};
1779 mutable std::vector<GUInt64> m_anCount{};
1780 std::vector<GUInt64> m_anStep{};
1781 std::vector<GUInt64> m_anDstOffset{};
1783 VRTMDArraySourceFromArray(
const VRTMDArraySourceFromArray&) =
delete;
1784 VRTMDArraySourceFromArray& operator=(
const VRTMDArraySourceFromArray&) =
delete;
1787 VRTMDArraySourceFromArray(
const VRTMDArray* poDstArray,
1788 bool bRelativeToVRTSet,
1789 bool bRelativeToVRT,
1790 const std::string& osFilename,
1791 const std::string& osArray,
1792 const std::string& osBand,
1793 std::vector<int>&& anTransposedAxis,
1794 const std::string& osViewExpr,
1795 std::vector<GUInt64>&& anSrcOffset,
1796 std::vector<GUInt64>&& anCount,
1797 std::vector<GUInt64>&& anStep,
1798 std::vector<GUInt64>&& anDstOffset):
1799 m_poDstArray(poDstArray),
1800 m_bRelativeToVRTSet(bRelativeToVRTSet),
1801 m_bRelativeToVRT(bRelativeToVRT),
1802 m_osFilename(osFilename),
1805 m_anTransposedAxis(std::move(anTransposedAxis)),
1806 m_osViewExpr(osViewExpr),
1807 m_anSrcOffset(std::move(anSrcOffset)),
1808 m_anCount(std::move(anCount)),
1809 m_anStep(std::move(anStep)),
1810 m_anDstOffset(std::move(anDstOffset))
1814 ~VRTMDArraySourceFromArray()
override;
1816 static std::unique_ptr<VRTMDArraySourceFromArray> Create(
1817 const VRTMDArray* poDstArray,
1820 bool Read(
const GUInt64* arrayStartIdx,
1821 const size_t* count,
1825 void* pDstBuffer)
const override;
1827 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
virtual std::shared_ptr< GDALMDArray > CreateMDArray(const std::string &osName, const std::vector< std::shared_ptr< GDALDimension >> &aoDimensions, const GDALExtendedDataType &oDataType, CSLConstList papszOptions=nullptr)
Create a multidimensional array within a group.
Definition: gdalmultidim.cpp:566
int GetShared() const
Returns shared flag.
Definition: gdaldataset.cpp:1376
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1850
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8648
virtual const std::string & GetUnit() const
Return the array unit.
Definition: gdalmultidim.cpp:2155
virtual std::shared_ptr< OGRSpatialReference > GetSpatialRef() const
Return the spatial reference system object associated with the array.
Definition: gdalmultidim.cpp:2183
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2374
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1879
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:251
Class for dataset open functions.
Definition: gdal_priv.h:271
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2954
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:2052
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2752
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2423
#define VRT_NODATA_UNSET
Special value to indicate that nodata is not set.
Definition: gdal_vrt.h:45
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:3825
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7182
void * VRTDatasetH
Opaque type for a VRT dataset.
Definition: gdal_vrt.h:76
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:3164
virtual bool SetUnit(const std::string &osUnit)
Set the variable unit.
Definition: gdalmultidim.cpp:2133
virtual CPLErr AddBand(GDALDataType eType, char **papszOptions=nullptr)
Add a band to a dataset.
Definition: gdaldataset.cpp:586
virtual bool IsWritable() const =0
Return whether an array is writable.
virtual std::shared_ptr< GDALGroup > GetRootGroup() const
Return the root GDALGroup of this dataset.
Definition: gdaldataset.cpp:8280
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:429
@ GDT_Unknown
Definition: gdal.h:64
Format specific driver.
Definition: gdal_priv.h:1558
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2162
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:6488
virtual double GetScale(bool *pbHasScale=nullptr, GDALDataType *peStorageType=nullptr) const
Get the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2498
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3641
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:3002
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:2282
virtual std::shared_ptr< GDALDimension > CreateDimension(const std::string &osName, const std::string &osType, const std::string &osDirection, GUInt64 nSize, CSLConstList papszOptions=nullptr)
Create a dimension within a group.
Definition: gdalmultidim.cpp:526
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1561
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
GDALColorInterp
Definition: gdal.h:204
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:119
Convenient string class based on std::string.
Definition: cpl_string.h:320
A single raster band (or channel).
Definition: gdal_priv.h:1179
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:249
virtual std::vector< std::shared_ptr< GDALAttribute > > GetAttributes(CSLConstList papszOptions=nullptr) const
Return the list of attributes contained in a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:223
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:269
#define CPL_NON_FINAL
Mark that a class is explicitly recognized as non-final.
Definition: cpl_port.h:923
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, int nBandCount, int *panBandList, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdaldataset.cpp:2722
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4113
GDALDataType
Definition: gdal.h:63
Document node structure.
Definition: cpl_minixml.h:69
Definition: gdalwarper.h:463
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1714
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1609
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2060
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:342
virtual std::vector< std::string > GetGroupNames(CSLConstList papszOptions=nullptr) const
Return the list of sub-groups contained in this group.
Definition: gdalmultidim.cpp:348
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1922
virtual int GetOverviewCount()
Return the number of overview layers available.
Definition: gdalrasterband.cpp:2508
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2456
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:6635
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS)
Assign a spatial reference system object to the the array.
Definition: gdalmultidim.cpp:2169
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:6720
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:248
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:233
static GDALDataset * Open(const char *pszFilename, unsigned int nOpenFlags=0, const char *const *papszAllowedDrivers=nullptr, const char *const *papszOpenOptions=nullptr, const char *const *papszSiblingFiles=nullptr)
Definition: gdal_priv.h:668
virtual std::shared_ptr< GDALGroup > CreateGroup(const std::string &osName, CSLConstList papszOptions=nullptr)
Create a sub-group within a group.
Definition: gdalmultidim.cpp:497
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1551
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1017
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1304
Ground Control Point.
Definition: gdal.h:892
CPLErr(* GDALDerivedPixelFuncWithArgs)(void **papoSources, int nSources, void *pData, int nBufXSize, int nBufYSize, GDALDataType eSrcType, GDALDataType eBufType, int nPixelSpace, int nLineSpace, CSLConstList papszFunctionArgs)
Type of functions to pass to GDALAddDerivedBandPixelFuncWithArgs.
Definition: gdal.h:1159
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:2763
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1468
@ GCI_Undefined
Definition: gdal.h:206
virtual bool SetOffset(double dfOffset, GDALDataType eStorageType=GDT_Unknown)
Set the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2469
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Definition: gdalrasterband.cpp:2550
virtual const GDALExtendedDataType & GetDataType() const =0
Return the data type of an attribute/array.
virtual char ** GetMetadataDomainList()
Fetch list of metadata domains.
Definition: gdalmajorobject.cpp:160
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
virtual bool SetRawNoDataValue(const void *pRawNoData)
Set the nodata value as a "raw" value.
Definition: gdalmultidim.cpp:2327
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2907
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:291
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4028
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3028
CPLErr(* VRTImageReadFunc)(void *hCBData, int nXOff, int nYOff, int nXSize, int nYSize, void *pData)
Type for a function that returns the pixel data in a provided window.
Definition: gdal_vrt.h:51
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:292
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:142
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1665
GDALAccess
Definition: gdal.h:116
virtual int64_t GetNoDataValueAsInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1721
virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1994
@ GA_ReadOnly
Definition: gdal.h:117
virtual std::shared_ptr< GDALMDArray > GetIndexingVariable() const
Return the variable that is used to index the dimension (if there is one).
Definition: gdalmultidim.cpp:8627
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:911
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1151
virtual bool SetScale(double dfScale, GDALDataType eStorageType=GDT_Unknown)
Set the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2440
virtual std::shared_ptr< GDALAttribute > CreateAttribute(const std::string &osName, const std::vector< GUInt64 > &anDimensions, const GDALExtendedDataType &oDataType, CSLConstList papszOptions=nullptr)
Create an attribute within a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:254
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2907
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:6587
virtual void FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:434
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
virtual double GetScale(int *pbSuccess=nullptr)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2858
GDALRWFlag
Definition: gdal.h:122
virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray, bool bStrict, GUInt64 &nCurCost, const GUInt64 nTotalCost, GDALProgressFunc pfnProgress, void *pProgressData)
Copy the content of an array into a new (generally empty) array.
Definition: gdalmultidim.cpp:3364
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2327
virtual std::vector< std::shared_ptr< GDALDimension > > GetDimensions(CSLConstList papszOptions=nullptr) const
Return the list of dimensions contained in this group and used by its arrays.
Definition: gdalmultidim.cpp:455
Object with metadata.
Definition: gdal_priv.h:136
Pansharpening operation class.
Definition: gdalpansharpen.h:188
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
CPLErr
Error category.
Definition: cpl_error.h:52
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:2338
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
CPLErr(* GDALDerivedPixelFunc)(void **papoSources, int nSources, void *pData, int nBufXSize, int nBufYSize, GDALDataType eSrcType, GDALDataType eBufType, int nPixelSpace, int nLineSpace)
Type of functions to pass to GDALAddDerivedBandPixelFunc.
Definition: gdal.h:1151
virtual CPLErr SetCategoryNames(char **papszNames)
Set the category names for this band.
Definition: gdalrasterband.cpp:1609
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:3254
virtual std::vector< std::string > GetMDArrayNames(CSLConstList papszOptions=nullptr) const
Return the list of multidimensional array names contained in this group.
Definition: gdalmultidim.cpp:300
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7041
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1096
virtual std::shared_ptr< GDALGroup > OpenGroup(const std::string &osName, CSLConstList papszOptions=nullptr) const
Open and return a sub-group.
Definition: gdalmultidim.cpp:372
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:7122
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
Definition: gdal_rat.h:47
virtual const void * GetRawNoDataValue() const
Return the nodata value as a "raw" value.
Definition: gdalmultidim.cpp:2209
virtual std::shared_ptr< GDALMDArray > OpenMDArray(const std::string &osName, CSLConstList papszOptions=nullptr) const
Open and return a multidimensional array.
Definition: gdalmultidim.cpp:324
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:2801
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:272
virtual double GetOffset(bool *pbHasOffset=nullptr, GDALDataType *peStorageType=nullptr) const
Get the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2528
VRTDatasetH VRTCreate(int, int)
Definition: vrtdataset.cpp:78
#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:930
virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1782
A color table / palette.
Definition: gdal_priv.h:1044