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 ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
124 double* adfMinMax ) = 0;
125 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
127 double *pdfMin,
double *pdfMax,
128 double *pdfMean,
double *pdfStdDev,
129 GDALProgressFunc pfnProgress,
130 void *pProgressData ) = 0;
131 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
132 double dfMin,
double dfMax,
133 int nBuckets,
GUIntBig * panHistogram,
134 int bIncludeOutOfRange,
int bApproxOK,
135 GDALProgressFunc pfnProgress,
136 void *pProgressData ) = 0;
139 std::map<CPLString, GDALDataset*>& ) = 0;
140 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
142 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
145 virtual int IsSimpleSource() {
return FALSE; }
146 virtual CPLErr FlushCache(
bool ) {
return CE_None; }
149 typedef VRTSource *(*VRTSourceParser)(
CPLXMLNode *,
const char *,
150 std::map<CPLString, GDALDataset*>& oMapSharedSources);
152 VRTSource *VRTParseCoreSources(
CPLXMLNode *psTree,
const char *,
153 std::map<CPLString, GDALDataset*>& oMapSharedSources);
154 VRTSource *VRTParseFilterSources(
CPLXMLNode *psTree,
const char *,
155 std::map<CPLString, GDALDataset*>& oMapSharedSources );
163 template<
class T>
struct VRTFlushCacheStruct
165 static void FlushCache(T& obj,
bool bAtClosing);
168 class VRTWarpedDataset;
169 class VRTPansharpenedDataset;
174 friend class VRTRasterBand;
175 friend struct VRTFlushCacheStruct<VRTDataset>;
176 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
177 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
178 friend class VRTSourcedRasterBand;
183 int m_bGeoTransformSet =
false;
184 double m_adfGeoTransform[6];
190 bool m_bNeedsFlush =
false;
191 bool m_bWritable =
true;
192 bool m_bCanTakeRef =
true;
194 char *m_pszVRTPath =
nullptr;
196 VRTRasterBand *m_poMaskBand =
nullptr;
198 int m_bCompatibleForDatasetIO = -1;
199 int CheckCompatibleForDatasetIO();
203 std::vector<GDALDataset*> m_apoOverviews{};
204 std::vector<GDALDataset*> m_apoOverviewsBak{};
206 std::vector<int> m_anOverviewFactors{};
208 char **m_papszXMLVRTMetadata =
nullptr;
210 std::map<CPLString, GDALDataset*> m_oMapSharedSources{};
211 std::shared_ptr<VRTGroup> m_poRootGroup{};
213 VRTRasterBand* InitBand(
const char* pszSubclass,
int nBand,
214 bool bAllowPansharpened);
215 static GDALDataset *OpenVRTProtocol(
const char* pszSpec );
216 bool AddVirtualOverview(
int nOvFactor,
217 const char* pszResampling);
225 VRTDataset(
int nXSize,
int nYSize);
226 virtual ~VRTDataset();
228 void SetNeedsFlush() { m_bNeedsFlush =
true; }
229 virtual void FlushCache(
bool bAtClosing)
override;
231 void SetWritable(
int bWritableIn) { m_bWritable = CPL_TO_BOOL(bWritableIn); }
234 void SetMaskBand(VRTRasterBand* poMaskBand);
243 const char *pszDomain =
"" )
override;
245 const char *pszDomain =
"" )
override;
247 virtual char**
GetMetadata(
const char *pszDomain =
"" )
override;
257 char **papszOptions=
nullptr )
override;
262 int nXOff,
int nYOff,
int nXSize,
int nYSize,
263 void * pData,
int nBufXSize,
int nBufYSize,
265 int nBandCount,
int *panBandMap,
271 int nBufXSize,
int nBufYSize,
273 int nBandCount,
int *panBandList,
274 char **papszOptions )
override;
276 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
279 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
280 int,
int *, GDALProgressFunc,
void * )
override;
282 std::shared_ptr<GDALGroup>
GetRootGroup()
const override;
286 void BuildVirtualOverviews();
288 void UnsetPreservedRelativeFilenames();
292 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
295 int nXSize,
int nYSize,
int nBands,
297 static GDALDataset *CreateMultiDimensional(
const char * pszFilename,
300 static CPLErr Delete(
const char * pszFilename );
308 class VRTWarpedRasterBand;
310 class CPL_DLL VRTWarpedDataset final:
public VRTDataset
316 int m_nOverviewCount;
317 VRTWarpedDataset **m_papoOverviews;
320 void CreateImplicitOverviews();
322 friend class VRTWarpedRasterBand;
327 virtual int CloseDependentDatasets()
override;
330 VRTWarpedDataset(
int nXSize,
int nYSize );
331 virtual ~VRTWarpedDataset();
333 virtual void FlushCache(
bool bAtClosing)
override;
335 CPLErr Initialize(
void * );
337 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
338 int,
int *, GDALProgressFunc,
void * )
override;
340 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
341 const char *pszDomain =
"" )
override;
343 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
347 char **papszOptions=
nullptr )
override;
349 virtual char **GetFileList()
override;
351 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
353 void GetBlockSize(
int *,
int * )
const;
365 GTAdjust_Intersection,
367 GTAdjust_NoneWithoutWarning
370 class VRTPansharpenedDataset final:
public VRTDataset
372 friend class VRTPansharpenedRasterBand;
377 VRTPansharpenedDataset* m_poMainDataset;
378 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets{};
380 std::map<CPLString,CPLString> m_oMapToRelativeFilenames{};
382 int m_bLoadingOtherBands;
384 GByte *m_pabyLastBufferBandRasterIO;
385 int m_nLastBandRasterIOXOff;
386 int m_nLastBandRasterIOYOff;
387 int m_nLastBandRasterIOXSize;
388 int m_nLastBandRasterIOYSize;
391 GTAdjustment m_eGTAdjustment;
392 int m_bNoDataDisabled;
394 std::vector<GDALDataset*> m_apoDatasetsToClose{};
399 virtual int CloseDependentDatasets()
override;
402 VRTPansharpenedDataset(
int nXSize,
int nYSize );
403 virtual ~VRTPansharpenedDataset();
405 virtual void FlushCache(
bool bAtClosing)
override;
408 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
412 int nInputSpectralBandsIn,
416 char **papszOptions=
nullptr )
override;
418 virtual char **GetFileList()
override;
421 int nXOff,
int nYOff,
int nXSize,
int nYSize,
422 void * pData,
int nBufXSize,
int nBufYSize,
424 int nBandCount,
int *panBandMap,
429 void GetBlockSize(
int *,
int * )
const;
441 constexpr
double VRT_DEFAULT_NODATA_VALUE = -10000.0;
447 void ResetNoDataValues();
450 friend class VRTDataset;
452 int m_bIsMaskBand = FALSE;
454 int m_bNoDataValueSet = FALSE;
456 int m_bHideNoDataValue = FALSE;
457 double m_dfNoDataValue = VRT_DEFAULT_NODATA_VALUE;
459 bool m_bNoDataSetAsInt64 =
false;
460 int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
462 bool m_bNoDataSetAsUInt64 =
false;
463 uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
465 std::unique_ptr<GDALColorTable> m_poColorTable{};
469 char *m_pszUnitType =
nullptr;
470 char **m_papszCategoryNames =
nullptr;
472 double m_dfOffset = 0.0;
473 double m_dfScale = 1.0;
477 void Initialize(
int nXSize,
int nYSize );
479 std::vector<VRTOverviewInfo> m_aoOverviewInfos{};
481 VRTRasterBand *m_poMaskBand =
nullptr;
483 std::unique_ptr<GDALRasterAttributeTable> m_poRAT{};
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();
588 bool SkipBufferInitialization();
592 VRTSource **papoSources =
nullptr;
594 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand );
596 int nXSize,
int nYSize );
597 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
599 int nXSize,
int nYSize );
600 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
602 int nXSize,
int nYSize,
603 int nBlockXSizeIn,
int nBlockYSizeIn );
604 virtual ~VRTSourcedRasterBand();
611 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
612 int nXSize,
int nYSize,
614 double* pdfDataPct)
override;
616 virtual char **GetMetadataDomainList()
override;
617 virtual const char *GetMetadataItem(
const char * pszName,
618 const char * pszDomain =
"" )
override;
619 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
620 virtual CPLErr SetMetadata(
char ** papszMetadata,
621 const char * pszDomain =
"" )
override;
622 virtual CPLErr SetMetadataItem(
const char * pszName,
623 const char * pszValue,
624 const char * pszDomain =
"" )
override;
627 std::map<CPLString, GDALDataset*>& )
override;
628 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
630 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
631 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
632 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
633 virtual CPLErr ComputeStatistics(
int bApproxOK,
634 double *pdfMin,
double *pdfMax,
635 double *pdfMean,
double *pdfStdDev,
636 GDALProgressFunc pfnProgress,
637 void *pProgressData )
override;
638 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
639 int nBuckets,
GUIntBig * panHistogram,
640 int bIncludeOutOfRange,
int bApproxOK,
641 GDALProgressFunc pfnProgress,
642 void *pProgressData )
override;
644 CPLErr AddSource( VRTSource * );
646 CPLErr AddSimpleSource(
const char* pszFilename,
648 double dfSrcXOff=-1,
double dfSrcYOff=-1,
649 double dfSrcXSize=-1,
double dfSrcYSize=-1,
650 double dfDstXOff=-1,
double dfDstYOff=-1,
651 double dfDstXSize=-1,
double dfDstYSize=-1,
652 const char *pszResampling =
"near",
656 double dfSrcXOff=-1,
double dfSrcYOff=-1,
657 double dfSrcXSize=-1,
double dfSrcYSize=-1,
658 double dfDstXOff=-1,
double dfDstYOff=-1,
659 double dfDstXSize=-1,
double dfDstYSize=-1,
660 const char *pszResampling =
"near",
663 CPLErr AddComplexSource(
const char* pszFilename,
665 double dfSrcXOff=-1,
double dfSrcYOff=-1,
666 double dfSrcXSize=-1,
double dfSrcYSize=-1,
667 double dfDstXOff=-1,
double dfDstYOff=-1,
668 double dfDstXSize=-1,
double dfDstYSize=-1,
669 double dfScaleOff=0.0,
670 double dfScaleRatio=1.0,
672 int nColorTableComponent = 0);
675 double dfSrcXOff=-1,
double dfSrcYOff=-1,
676 double dfSrcXSize=-1,
double dfSrcYSize=-1,
677 double dfDstXOff=-1,
double dfDstYOff=-1,
678 double dfDstXSize=-1,
double dfDstYSize=-1,
679 double dfScaleOff=0.0,
680 double dfScaleRatio=1.0,
682 int nColorTableComponent = 0);
685 double dfSrcXOff=-1,
double dfSrcYOff=-1,
686 double dfSrcXSize=-1,
687 double dfSrcYSize=-1,
688 double dfDstXOff=-1,
double dfDstYOff=-1,
689 double dfDstXSize=-1,
690 double dfDstYSize=-1 );
695 void ConfigureSource(VRTSimpleSource *poSimpleSource,
698 double dfSrcXOff,
double dfSrcYOff,
699 double dfSrcXSize,
double dfSrcYSize,
700 double dfDstXOff,
double dfDstYOff,
701 double dfDstXSize,
double dfDstYSize );
703 void RemoveCoveredSources(
CSLConstList papszOptions =
nullptr);
705 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
707 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
708 int *pnMaxSize,
CPLHashSet* hSetFiles)
override;
710 virtual int CloseDependentDatasets()
override;
712 virtual int IsSourcedRasterBand()
override {
return TRUE; }
714 virtual CPLErr FlushCache(
bool bAtClosing)
override;
721 class CPL_DLL VRTWarpedRasterBand final:
public VRTRasterBand
726 virtual ~VRTWarpedRasterBand();
728 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
730 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
731 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
733 virtual int GetOverviewCount()
override;
740 class VRTPansharpenedRasterBand final:
public VRTRasterBand
742 int m_nIndexAsPansharpenedBand;
745 VRTPansharpenedRasterBand(
748 virtual ~VRTPansharpenedRasterBand();
750 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
752 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
755 int nXOff,
int nYOff,
int nXSize,
int nYSize,
756 void * pData,
int nBufXSize,
int nBufYSize,
761 virtual int GetOverviewCount()
override;
764 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
766 void SetIndexAsPansharpenedBand(
int nIdx )
767 { m_nIndexAsPansharpenedBand = nIdx; }
768 int GetIndexAsPansharpenedBand()
const
769 {
return m_nIndexAsPansharpenedBand; }
776 class VRTDerivedRasterBandPrivateData;
778 class CPL_DLL VRTDerivedRasterBand
CPL_NON_FINAL:
public VRTSourcedRasterBand
780 VRTDerivedRasterBandPrivateData* m_poPrivate;
781 bool InitializePython();
782 CPLErr GetPixelFunctionArguments(
784 std::vector<std::pair<CPLString, CPLString>> &);
794 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand );
795 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand,
797 virtual ~VRTDerivedRasterBand();
804 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
805 int nXSize,
int nYSize,
807 double* pdfDataPct)
override;
809 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
811 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
813 const char *pszMetadata);
815 static std::pair<PixelFunc, CPLString>* GetPixelFunction(
const char *pszFuncNameIn );
817 void SetPixelFunctionName(
const char *pszFuncNameIn );
819 void SetPixelFunctionLanguage(
const char* pszLanguage );
822 std::map<CPLString, GDALDataset*>& )
override;
823 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
825 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
826 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
827 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
828 virtual CPLErr ComputeStatistics(
int bApproxOK,
829 double *pdfMin,
double *pdfMax,
830 double *pdfMean,
double *pdfStdDev,
831 GDALProgressFunc pfnProgress,
832 void *pProgressData )
override;
833 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
834 int nBuckets,
GUIntBig * panHistogram,
835 int bIncludeOutOfRange,
int bApproxOK,
836 GDALProgressFunc pfnProgress,
837 void *pProgressData )
override;
839 static void Cleanup();
848 class CPL_DLL VRTRawRasterBand
CPL_NON_FINAL:
public VRTRasterBand
850 RawRasterBand *m_poRawRaster;
852 char *m_pszSourceFilename;
853 int m_bRelativeToVRT;
860 virtual ~VRTRawRasterBand();
863 std::map<CPLString, GDALDataset*>& )
override;
864 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
871 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
872 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
874 CPLErr SetRawLink(
const char *pszFilename,
875 const char *pszVRTPath,
878 int nPixelOffset,
int nLineOffset,
879 const char *pszByteOrder );
886 char **papszOptions )
override;
888 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
889 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
902 virtual ~VRTDriver();
904 char **papszSourceParsers;
907 virtual char **
GetMetadata(
const char * pszDomain =
"" )
override;
909 const char * pszDomain =
"" )
override;
911 VRTSource *ParseSource(
CPLXMLNode *psSrc,
const char *pszVRTPath,
912 std::map<CPLString, GDALDataset*>& oMapSharedSources );
913 void AddSourceParser(
const char *pszElementName,
914 VRTSourceParser pfnParser );
921 class CPL_DLL VRTSimpleSource
CPL_NON_FINAL:
public VRTSource
927 std::map<CPLString, GDALDataset*>* m_poMapSharedSources =
nullptr;
937 void OpenSource()
const;
940 friend class VRTSourcedRasterBand;
941 friend class VRTDataset;
944 bool m_bGetMaskBand =
false;
946 double m_dfSrcXOff = 0;
947 double m_dfSrcYOff = 0;
948 double m_dfSrcXSize = 0;
949 double m_dfSrcYSize = 0;
951 double m_dfDstXOff = 0;
952 double m_dfDstYOff = 0;
953 double m_dfDstXSize = 0;
954 double m_dfDstYSize = 0;
957 int m_bNoDataSet =
false;
965 int m_bRelativeToVRTOri = -1;
967 int m_nExplicitSharedStatus = -1;
970 bool m_bDropRefOnSrcBand =
true;
972 int NeedMaxValAdjustment()
const;
974 double GetAdjustedNoDataValue()
const;
978 VRTSimpleSource(
const VRTSimpleSource* poSrcSource,
979 double dfXDstRatio,
double dfYDstRatio );
980 virtual ~VRTSimpleSource();
983 std::map<CPLString, GDALDataset*>& )
override;
984 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
986 void SetSrcBand(
const char* pszFilename,
int nBand );
989 void SetSrcWindow(
double,
double,
double,
double );
990 void SetDstWindow(
double,
double,
double,
double );
991 void SetNoDataValue(
double dfNoDataValue );
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 ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1013 double* adfMinMax )
override;
1014 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1016 double *pdfMin,
double *pdfMax,
1017 double *pdfMean,
double *pdfStdDev,
1018 GDALProgressFunc pfnProgress,
1019 void *pProgressData )
override;
1020 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1021 double dfMin,
double dfMax,
1022 int nBuckets,
GUIntBig * panHistogram,
1023 int bIncludeOutOfRange,
int bApproxOK,
1024 GDALProgressFunc pfnProgress,
1025 void *pProgressData )
override;
1027 void DstToSrc(
double dfX,
double dfY,
1028 double &dfXOut,
double &dfYOut )
const;
1029 void SrcToDst(
double dfX,
double dfY,
1030 double &dfXOut,
double &dfYOut )
const;
1032 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
1033 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
1035 virtual int IsSimpleSource()
override {
return TRUE; }
1036 virtual const char* GetType() {
return "SimpleSource"; }
1037 virtual CPLErr FlushCache(
bool bAtClosing)
override;
1041 int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
1044 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1045 void * pData,
int nBufXSize,
int nBufYSize,
1047 int nBandCount,
int *panBandMap,
1052 void UnsetPreservedRelativeFilenames();
1054 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
1061 class VRTAveragedSource final:
public VRTSimpleSource
1066 VRTAveragedSource();
1068 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1069 void *pData,
int nBufXSize,
int nBufYSize,
1074 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1075 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1076 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1077 double* adfMinMax )
override;
1078 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1080 double *pdfMin,
double *pdfMax,
1081 double *pdfMean,
double *pdfStdDev,
1082 GDALProgressFunc pfnProgress,
1083 void *pProgressData )
override;
1084 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1085 double dfMin,
double dfMax,
1086 int nBuckets,
GUIntBig * panHistogram,
1087 int bIncludeOutOfRange,
int bApproxOK,
1088 GDALProgressFunc pfnProgress,
1089 void *pProgressData )
override;
1091 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1092 virtual const char* GetType()
override {
return "AveragedSource"; }
1103 VRT_SCALING_EXPONENTIAL,
1104 } VRTComplexSourceScaling;
1106 class CPL_DLL VRTComplexSource
CPL_NON_FINAL:
public VRTSimpleSource
1109 bool AreValuesUnchanged()
const;
1112 VRTComplexSourceScaling m_eScalingType;
1113 double m_dfScaleOff;
1114 double m_dfScaleRatio;
1117 int m_bSrcMinMaxDefined;
1122 double m_dfExponent;
1124 int m_nColorTableComponent;
1126 bool m_bUseMaskBand =
false;
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 ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1153 double* adfMinMax )
override;
1154 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1156 double *pdfMin,
double *pdfMax,
1157 double *pdfMean,
double *pdfStdDev,
1158 GDALProgressFunc pfnProgress,
1159 void *pProgressData )
override;
1160 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1161 double dfMin,
double dfMax,
1162 int nBuckets,
GUIntBig * panHistogram,
1163 int bIncludeOutOfRange,
int bApproxOK,
1164 GDALProgressFunc pfnProgress,
1165 void *pProgressData )
override;
1167 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1169 std::map<CPLString, GDALDataset*>& )
override;
1170 virtual const char* GetType()
override {
return "ComplexSource"; }
1172 double LookupValue(
double dfInput );
1174 void SetUseMaskBand(
bool bUseMaskBand) { m_bUseMaskBand = bUseMaskBand; }
1176 void SetLinearScaling(
double dfOffset,
double dfScale );
1177 void SetPowerScaling(
double dfExponent,
1182 void SetColorTableComponent(
int nComponent );
1184 double *m_padfLUTInputs;
1185 double *m_padfLUTOutputs;
1186 int m_nLUTItemCount;
1193 class VRTFilteredSource
CPL_NON_FINAL:
public VRTComplexSource
1201 int m_nSupportedTypesCount;
1204 int m_nExtraEdgePixels;
1207 VRTFilteredSource();
1208 virtual ~VRTFilteredSource();
1210 void SetExtraEdgePixels(
int );
1211 void SetFilteringDataTypesSupported(
int,
GDALDataType * );
1214 GByte *pabySrcData,
GByte *pabyDstData ) = 0;
1217 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1218 void *pData,
int nBufXSize,
int nBufYSize,
1228 class VRTKernelFilteredSource
CPL_NON_FINAL:
public VRTFilteredSource
1237 double *m_padfKernelCoefs;
1242 VRTKernelFilteredSource();
1243 virtual ~VRTKernelFilteredSource();
1246 std::map<CPLString, GDALDataset*>& )
override;
1247 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1250 GByte *pabySrcData,
GByte *pabyDstData )
override;
1252 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1253 void SetNormalized(
int );
1260 class VRTAverageFilteredSource final:
public VRTKernelFilteredSource
1265 explicit VRTAverageFilteredSource(
int nKernelSize );
1266 virtual ~VRTAverageFilteredSource();
1269 std::map<CPLString, GDALDataset*>& )
override;
1270 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1276 class VRTFuncSource final:
public VRTSource
1282 virtual ~VRTFuncSource();
1285 std::map<CPLString, GDALDataset*>& )
override {
return CE_Failure; }
1286 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1289 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1290 void *pData,
int nBufXSize,
int nBufYSize,
1295 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1296 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1297 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1298 double* adfMinMax )
override;
1299 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1301 double *pdfMin,
double *pdfMax,
1302 double *pdfMean,
double *pdfStdDev,
1303 GDALProgressFunc pfnProgress,
1304 void *pProgressData )
override;
1305 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1306 double dfMin,
double dfMax,
1307 int nBuckets,
GUIntBig * panHistogram,
1308 int bIncludeOutOfRange,
int bApproxOK,
1309 GDALProgressFunc pfnProgress,
1310 void *pProgressData )
override;
1324 #define TMP_CPL_DLL CPL_DLL
1339 explicit Ref(VRTGroup* ptr): m_ptr(ptr) {}
1340 Ref(
const Ref&) =
delete;
1341 Ref& operator=(
const Ref&) =
delete;
1345 std::shared_ptr<Ref> m_poSharedRefRootGroup{};
1346 std::weak_ptr<Ref> m_poWeakRefRootGroup{};
1347 std::shared_ptr<Ref> m_poRefSelf{};
1349 std::string m_osFilename{};
1350 mutable bool m_bDirty =
false;
1351 std::string m_osVRTPath{};
1352 std::map<std::string, std::shared_ptr<VRTGroup>> m_oMapGroups{};
1353 std::map<std::string, std::shared_ptr<VRTMDArray>> m_oMapMDArrays{};
1354 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1355 std::map<std::string, std::shared_ptr<VRTDimension>> m_oMapDimensions{};
1357 std::shared_ptr<VRTGroup> OpenGroupInternal(
const std::string& osName)
const;
1358 void SetRootGroupRef(
const std::weak_ptr<Ref>& rgRef);
1359 std::weak_ptr<Ref> GetRootGroupRef()
const;
1363 VRTGroup(
const std::string& osParentName,
const std::string& osName);
1366 bool XMLInit(
const std::shared_ptr<VRTGroup>& poRoot,
1367 const std::shared_ptr<VRTGroup>& poThisGroup,
1369 const char* pszVRTPath);
1372 std::shared_ptr<GDALMDArray>
OpenMDArray(
const std::string& osName,
1376 std::shared_ptr<GDALGroup>
OpenGroup(
const std::string& osName,
1379 return OpenGroupInternal(osName);
1386 std::shared_ptr<VRTDimension> GetDimension(
const std::string& name)
const {
1387 auto oIter = m_oMapDimensions.find(name);
1388 return oIter == m_oMapDimensions.end() ? nullptr : oIter->second;
1390 std::shared_ptr<VRTDimension> GetDimensionFromFullName(
const std::string& name,
1391 bool bEmitError)
const;
1393 std::shared_ptr<GDALGroup>
CreateGroup(
const std::string& osName,
1396 std::shared_ptr<GDALDimension>
CreateDimension(
const std::string& osName,
1397 const std::string& osType,
1398 const std::string& osDirection,
1403 const std::string& osName,
1404 const std::vector<GUInt64>& anDimensions,
1408 std::shared_ptr<GDALMDArray>
CreateMDArray(
const std::string& osName,
1409 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
1413 void SetIsRootGroup();
1415 const std::shared_ptr<Ref>& GetRef()
const {
return m_poRefSelf; }
1416 VRTGroup* GetRootGroup()
const;
1418 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1420 void SetFilename(
const std::string& osFilename) { m_osFilename = osFilename; }
1421 const std::string& GetFilename()
const {
return m_osFilename; }
1422 void Serialize()
const;
1423 CPLXMLNode* SerializeToXML(
const char *pszVRTPathIn )
const;
1424 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn)
const;
1433 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1434 std::string m_osIndexingVariableName;
1437 VRTDimension(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1438 const std::string& osParentName,
1439 const std::string& osName,
1440 const std::string& osType,
1441 const std::string& osDirection,
1443 const std::string& osIndexingVariableName):
1444 GDALDimension(osParentName, osName, osType, osDirection, nSize),
1445 m_poGroupRef(poGroupRef),
1446 m_osIndexingVariableName(osIndexingVariableName)
1449 VRTGroup* GetGroup()
const;
1451 static std::shared_ptr<VRTDimension> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1452 const std::string& osParentName,
1469 std::vector<std::string> m_aosList{};
1470 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
1474 bool IRead(
const GUInt64* arrayStartIdx,
1475 const size_t* count,
1479 void* pDstBuffer)
const override;
1481 bool IWrite(
const GUInt64* arrayStartIdx,
1482 const size_t* count,
1486 const void* pSrcBuffer)
override;
1490 VRTAttribute(
const std::string& osParentName,
1491 const std::string& osName,
1493 std::vector<std::string>&& aosList):
1497 m_aosList(std::move(aosList))
1499 if( m_aosList.size() > 1 )
1501 m_dims.emplace_back(std::make_shared<GDALDimension>(
1502 std::string(),
"dim",
1503 std::string(), std::string(), m_aosList.size()));
1507 VRTAttribute(
const std::string& osParentName,
1508 const std::string& osName,
1517 m_dims.emplace_back(std::make_shared<GDALDimension>(
1518 std::string(),
"dim",
1519 std::string(), std::string(), nDim));
1523 static bool CreationCommonChecks(
const std::string& osName,
1524 const std::vector<GUInt64>& anDimensions,
1525 const std::map<std::string, std::shared_ptr<VRTAttribute>>& oMapAttributes);
1527 static std::shared_ptr<VRTAttribute> Create(
const std::string& osParentName,
1530 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1541 class VRTMDArraySource
1544 virtual ~VRTMDArraySource() =
default;
1546 virtual bool Read(
const GUInt64* arrayStartIdx,
1547 const size_t* count,
1551 void* pDstBuffer)
const = 0;
1553 virtual void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const = 0;
1563 friend class VRTGroup;
1565 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1566 std::string m_osVRTPath{};
1569 std::vector<std::shared_ptr<GDALDimension>> m_dims;
1570 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1571 std::vector<std::unique_ptr<VRTMDArraySource>> m_sources{};
1572 std::shared_ptr<OGRSpatialReference> m_poSRS{};
1573 std::vector<GByte> m_abyNoData{};
1574 std::string m_osUnit{};
1575 double m_dfScale = 1.0;
1576 double m_dfOffset = 0.0;
1577 bool m_bHasScale =
false;
1578 bool m_bHasOffset =
false;
1579 std::string m_osFilename{};
1581 bool IRead(
const GUInt64* arrayStartIdx,
1582 const size_t* count,
1586 void* pDstBuffer)
const override;
1591 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1592 const std::string& osParentName,
1593 const std::string& osName,
1595 std::vector<std::shared_ptr<GDALDimension>>&& dims,
1596 std::map<std::string, std::shared_ptr<VRTAttribute>>&& oMapAttributes) :
1599 m_poGroupRef(poGroupRef),
1600 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1602 m_dims(std::move(dims)),
1603 m_oMapAttributes(std::move(oMapAttributes)),
1604 m_osFilename(poGroupRef->m_ptr->GetFilename())
1608 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1609 const std::string& osParentName,
1610 const std::string& osName,
1611 const std::vector<std::shared_ptr<GDALDimension>>& dims,
1615 m_poGroupRef(poGroupRef),
1616 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1619 m_osFilename(poGroupRef->m_ptr->GetFilename())
1623 bool IsWritable()
const override {
return false; }
1625 const std::string&
GetFilename()
const override {
return m_osFilename; }
1627 static std::shared_ptr<VRTMDArray> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1628 const std::string& osParentName,
1631 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1639 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override {
return m_poSRS; }
1645 const std::string&
GetUnit()
const override {
return m_osUnit; }
1647 bool SetUnit(
const std::string& osUnit)
override {
1648 m_osUnit = osUnit;
return true; }
1652 if( pbHasOffset) *pbHasOffset = m_bHasOffset;
1659 if( pbHasScale) *pbHasScale = m_bHasScale;
1665 { SetDirty(); m_bHasOffset =
true; m_dfOffset = dfOffset;
return true; }
1668 { SetDirty(); m_bHasScale =
true; m_dfScale = dfScale;
return true; }
1670 void AddSource(std::unique_ptr<VRTMDArraySource>&& poSource);
1673 const std::string& osName,
1674 const std::vector<GUInt64>& anDimensions,
1683 GDALProgressFunc pfnProgress,
1684 void * pProgressData)
override;
1686 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn )
const;
1688 VRTGroup* GetGroup()
const;
1690 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1697 class VRTMDArraySourceInlinedValues final:
public VRTMDArraySource
1699 const VRTMDArray* m_poDstArray =
nullptr;
1700 bool m_bIsConstantValue;
1701 std::vector<GUInt64> m_anOffset{};
1702 std::vector<size_t> m_anCount{};
1703 std::vector<GByte> m_abyValues{};
1704 std::vector<size_t> m_anInlinedArrayStrideInBytes{};
1707 VRTMDArraySourceInlinedValues(
const VRTMDArraySourceInlinedValues&) =
delete;
1708 VRTMDArraySourceInlinedValues& operator=(
const VRTMDArraySourceInlinedValues&) =
delete;
1711 VRTMDArraySourceInlinedValues(
const VRTMDArray* poDstArray,
1712 bool bIsConstantValue,
1713 std::vector<GUInt64>&& anOffset,
1714 std::vector<size_t>&& anCount,
1715 std::vector<GByte>&& abyValues):
1716 m_poDstArray(poDstArray),
1717 m_bIsConstantValue(bIsConstantValue),
1718 m_anOffset(std::move(anOffset)),
1719 m_anCount(std::move(anCount)),
1720 m_abyValues(std::move(abyValues)),
1721 m_dt(poDstArray->GetDataType())
1723 const auto nDims(poDstArray->GetDimensionCount());
1724 m_anInlinedArrayStrideInBytes.resize(nDims);
1725 if( !bIsConstantValue && nDims > 0 )
1727 m_anInlinedArrayStrideInBytes.back() = poDstArray->GetDataType().GetSize();
1728 for(
size_t i = nDims - 1; i > 0; )
1731 m_anInlinedArrayStrideInBytes[i] =
1732 m_anInlinedArrayStrideInBytes[i+1] * m_anCount[i+1];
1737 ~VRTMDArraySourceInlinedValues();
1739 static std::unique_ptr<VRTMDArraySourceInlinedValues> Create(
1740 const VRTMDArray* poDstArray,
1743 bool Read(
const GUInt64* arrayStartIdx,
1744 const size_t* count,
1748 void* pDstBuffer)
const override;
1750 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1757 class VRTMDArraySourceRegularlySpaced final:
public VRTMDArraySource
1760 double m_dfIncrement;
1763 VRTMDArraySourceRegularlySpaced(
1764 double dfStart,
double dfIncrement):
1766 m_dfIncrement(dfIncrement)
1770 bool Read(
const GUInt64* arrayStartIdx,
1771 const size_t* count,
1775 void* pDstBuffer)
const override;
1777 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1784 class VRTMDArraySourceFromArray final:
public VRTMDArraySource
1786 const VRTMDArray* m_poDstArray =
nullptr;
1787 bool m_bRelativeToVRTSet =
false;
1788 bool m_bRelativeToVRT =
false;
1789 std::string m_osFilename{};
1790 std::string m_osArray{};
1791 std::string m_osBand{};
1792 std::vector<int> m_anTransposedAxis{};
1793 std::string m_osViewExpr{};
1794 std::vector<GUInt64> m_anSrcOffset{};
1795 mutable std::vector<GUInt64> m_anCount{};
1796 std::vector<GUInt64> m_anStep{};
1797 std::vector<GUInt64> m_anDstOffset{};
1799 VRTMDArraySourceFromArray(
const VRTMDArraySourceFromArray&) =
delete;
1800 VRTMDArraySourceFromArray& operator=(
const VRTMDArraySourceFromArray&) =
delete;
1803 VRTMDArraySourceFromArray(
const VRTMDArray* poDstArray,
1804 bool bRelativeToVRTSet,
1805 bool bRelativeToVRT,
1806 const std::string& osFilename,
1807 const std::string& osArray,
1808 const std::string& osBand,
1809 std::vector<int>&& anTransposedAxis,
1810 const std::string& osViewExpr,
1811 std::vector<GUInt64>&& anSrcOffset,
1812 std::vector<GUInt64>&& anCount,
1813 std::vector<GUInt64>&& anStep,
1814 std::vector<GUInt64>&& anDstOffset):
1815 m_poDstArray(poDstArray),
1816 m_bRelativeToVRTSet(bRelativeToVRTSet),
1817 m_bRelativeToVRT(bRelativeToVRT),
1818 m_osFilename(osFilename),
1821 m_anTransposedAxis(std::move(anTransposedAxis)),
1822 m_osViewExpr(osViewExpr),
1823 m_anSrcOffset(std::move(anSrcOffset)),
1824 m_anCount(std::move(anCount)),
1825 m_anStep(std::move(anStep)),
1826 m_anDstOffset(std::move(anDstOffset))
1830 ~VRTMDArraySourceFromArray()
override;
1832 static std::unique_ptr<VRTMDArraySourceFromArray> Create(
1833 const VRTMDArray* poDstArray,
1836 bool Read(
const GUInt64* arrayStartIdx,
1837 const size_t* count,
1841 void* pDstBuffer)
const override;
1843 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:1457
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1814
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8239
virtual const std::string & GetUnit() const
Return the array unit.
Definition: gdalmultidim.cpp:2109
virtual std::shared_ptr< OGRSpatialReference > GetSpatialRef() const
Return the spatial reference system object associated with the array.
Definition: gdalmultidim.cpp:2137
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2338
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1845
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:251
Class for dataset open functions.
Definition: gdal_priv.h:268
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2915
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:2016
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2713
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2387
#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:3757
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:6667
void * VRTDatasetH
Opaque type for a VRT dataset.
Definition: gdal_vrt.h:76
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:3125
virtual bool SetUnit(const std::string &osUnit)
Set the variable unit.
Definition: gdalmultidim.cpp:2087
virtual CPLErr AddBand(GDALDataType eType, char **papszOptions=nullptr)
Add a band to a dataset.
Definition: gdaldataset.cpp:587
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:8392
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:428
@ GDT_Unknown
Definition: gdal.h:64
Format specific driver.
Definition: gdal_priv.h:1524
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:2121
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:6012
virtual double GetScale(bool *pbHasScale=nullptr, GDALDataType *peStorageType=nullptr) const
Get the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2452
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3757
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:2963
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:2246
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:1525
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:120
Convenient string class based on std::string.
Definition: cpl_string.h:319
A single raster band (or channel).
Definition: gdal_priv.h:1150
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:266
#define CPL_NON_FINAL
Mark that a class is explicitly recognized as non-final.
Definition: cpl_port.h:920
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:2841
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4229
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:1834
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1729
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2019
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:339
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:1886
virtual int GetOverviewCount()
Return the number of overview layers available.
Definition: gdalrasterband.cpp:2472
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2415
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:6159
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS)
Assign a spatial reference system object to the the array.
Definition: gdalmultidim.cpp:2123
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:6244
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:249
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1053
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:655
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:1646
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1059
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1385
Ground Control Point.
Definition: gdal.h:732
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:970
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:2703
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1549
@ 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:2423
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Definition: gdalrasterband.cpp:2514
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:161
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:2281
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2868
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:292
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4144
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3147
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:287
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1629
GDALAccess
Definition: gdal.h:116
virtual int64_t GetNoDataValueAsInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1685
virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1958
@ 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:8218
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:928
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:1232
virtual bool SetScale(double dfScale, GDALDataType eStorageType=GDT_Unknown)
Set the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2394
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:3026
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:6111
virtual void FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:435
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:2819
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:3314
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2291
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:135
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:2297
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:962
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:3215
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:6526
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1177
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:6607
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:2163
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:2762
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:2482
VRTDatasetH VRTCreate(int, int)
Definition: vrtdataset.cpp:79
#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:927
virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1746
A color table / palette.
Definition: gdal_priv.h:1032