31 #ifndef VIRTUALDATASET_H_INCLUDED
32 #define VIRTUALDATASET_H_INCLUDED
51 CPLErr GDALRegisterDefaultPixelFunc();
55 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
57 double *padfX,
double *padfY,
double *padfZ,
59 void* VRTDeserializeWarpedOverviewTransformer(
CPLXMLNode *psTree );
73 int bTriedToOpen = FALSE;
75 VRTOverviewInfo() =
default;
76 VRTOverviewInfo(VRTOverviewInfo &&oOther) noexcept
77 : osFilename(std::move(oOther.osFilename)), nBand(oOther.nBand),
78 poBand(oOther.poBand), bTriedToOpen(oOther.bTriedToOpen)
80 oOther.poBand =
nullptr;
90 if (poBand ==
nullptr)
109 class CPL_DLL VRTSource
112 virtual ~VRTSource();
115 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
120 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess) = 0;
121 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess) = 0;
122 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
double dfMin,
123 double dfMax,
int nBuckets,
124 GUIntBig *panHistogram,
int bIncludeOutOfRange,
125 int bApproxOK, GDALProgressFunc pfnProgress,
126 void *pProgressData) = 0;
129 std::map<CPLString, GDALDataset *> &) = 0;
130 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath) = 0;
132 virtual void GetFileList(
char ***ppapszFileList,
int *pnSize,
135 virtual int IsSimpleSource()
139 virtual CPLErr FlushCache(
bool )
145 typedef VRTSource *(*VRTSourceParser)(
147 std::map<CPLString, GDALDataset *> &oMapSharedSources);
150 VRTParseCoreSources(
CPLXMLNode *psTree,
const char *,
151 std::map<CPLString, GDALDataset *> &oMapSharedSources);
153 VRTParseFilterSources(
CPLXMLNode *psTree,
const char *,
154 std::map<CPLString, GDALDataset *> &oMapSharedSources);
162 template <
class T>
struct VRTFlushCacheStruct
164 static CPLErr FlushCache(T &obj,
bool bAtClosing);
167 class VRTWarpedDataset;
168 class VRTPansharpenedDataset;
173 friend class VRTRasterBand;
174 friend struct VRTFlushCacheStruct<VRTDataset>;
175 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
176 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
177 friend class VRTSourcedRasterBand;
182 int m_bGeoTransformSet =
false;
183 double m_adfGeoTransform[6];
189 bool m_bNeedsFlush =
false;
190 bool m_bWritable =
true;
191 bool m_bCanTakeRef =
true;
193 char *m_pszVRTPath =
nullptr;
195 VRTRasterBand *m_poMaskBand =
nullptr;
197 int m_bCompatibleForDatasetIO = -1;
198 int CheckCompatibleForDatasetIO();
202 std::vector<GDALDataset *> m_apoOverviews{};
203 std::vector<GDALDataset *> m_apoOverviewsBak{};
205 std::vector<int> m_anOverviewFactors{};
207 char **m_papszXMLVRTMetadata =
nullptr;
209 std::map<CPLString, GDALDataset *> m_oMapSharedSources{};
210 std::shared_ptr<VRTGroup> m_poRootGroup{};
212 VRTRasterBand *InitBand(
const char *pszSubclass,
int nBand,
213 bool bAllowPansharpened);
214 static GDALDataset *OpenVRTProtocol(
const char *pszSpec);
215 bool AddVirtualOverview(
int nOvFactor,
const char *pszResampling);
217 bool GetShiftedDataset(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
224 bool m_bBlockSizeSpecified =
false;
225 int m_nBlockXSize = 0;
226 int m_nBlockYSize = 0;
231 VRTDataset(
int nXSize,
int nYSize,
int nBlockXSize = 0,
232 int nBlockYSize = 0);
233 virtual ~VRTDataset();
237 m_bNeedsFlush =
true;
241 void SetWritable(
int bWritableIn)
243 m_bWritable = CPL_TO_BOOL(bWritableIn);
247 void SetMaskBand(VRTRasterBand *poMaskBand);
259 const char *pszDomain =
"")
override;
261 const char *pszDomain =
"")
override;
263 virtual char **
GetMetadata(
const char *pszDomain =
"")
override;
276 char **papszOptions =
nullptr)
override;
281 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
283 int nBandCount,
int *panBandMap,
290 int nBandCount,
const int *panBandList)
override;
292 int nYOff,
int nXSize,
int nYSize,
293 int nBandCount,
const int *panBandList,
294 void **ppBuffer,
size_t *pnBufferSize,
295 char **ppszDetailedFormat)
override;
299 int nBandCount,
int *panBandList,
300 char **papszOptions)
override;
302 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
305 virtual CPLErr IBuildOverviews(
const char *,
int,
const int *,
int,
306 const int *, GDALProgressFunc,
void *,
309 std::shared_ptr<GDALGroup>
GetRootGroup()
const override;
313 void BuildVirtualOverviews();
315 void UnsetPreservedRelativeFilenames();
317 bool IsBlockSizeSpecified()
const
319 return m_bBlockSizeSpecified;
321 int GetBlockXSize()
const
323 return m_nBlockXSize;
325 int GetBlockYSize()
const
327 return m_nBlockYSize;
332 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
334 static GDALDataset *Create(
const char *pszName,
int nXSize,
int nYSize,
336 char **papszOptions);
338 CreateMultiDimensional(
const char *pszFilename,
341 static CPLErr Delete(
const char *pszFilename);
349 class VRTWarpedRasterBand;
351 class CPL_DLL VRTWarpedDataset final :
public VRTDataset
355 int m_nOverviewCount;
356 VRTWarpedDataset **m_papoOverviews;
359 void CreateImplicitOverviews();
361 friend class VRTWarpedRasterBand;
366 virtual int CloseDependentDatasets()
override;
369 VRTWarpedDataset(
int nXSize,
int nYSize,
int nBlockXSize = 0,
370 int nBlockYSize = 0);
371 virtual ~VRTWarpedDataset();
373 virtual CPLErr FlushCache(
bool bAtClosing)
override;
375 CPLErr Initialize(
void *);
377 virtual CPLErr IBuildOverviews(
const char *,
int,
const int *,
int,
378 const int *, GDALProgressFunc,
void *,
381 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
382 const char *pszDomain =
"")
override;
384 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
388 char **papszOptions =
nullptr)
override;
390 virtual char **GetFileList()
override;
392 CPLErr ProcessBlock(
int iBlockX,
int iBlockY);
394 void GetBlockSize(
int *,
int *)
const;
406 GTAdjust_Intersection,
408 GTAdjust_NoneWithoutWarning
411 class VRTPansharpenedDataset final :
public VRTDataset
413 friend class VRTPansharpenedRasterBand;
416 VRTPansharpenedDataset *m_poMainDataset;
417 std::vector<VRTPansharpenedDataset *> m_apoOverviewDatasets{};
419 std::map<CPLString, CPLString> m_oMapToRelativeFilenames{};
421 int m_bLoadingOtherBands;
423 GByte *m_pabyLastBufferBandRasterIO;
424 int m_nLastBandRasterIOXOff;
425 int m_nLastBandRasterIOYOff;
426 int m_nLastBandRasterIOXSize;
427 int m_nLastBandRasterIOYSize;
430 GTAdjustment m_eGTAdjustment;
431 int m_bNoDataDisabled;
433 std::vector<GDALDataset *> m_apoDatasetsToClose{};
438 virtual int CloseDependentDatasets()
override;
441 VRTPansharpenedDataset(
int nXSize,
int nYSize,
int nBlockXSize = 0,
442 int nBlockYSize = 0);
443 virtual ~VRTPansharpenedDataset();
445 virtual CPLErr FlushCache(
bool bAtClosing)
override;
448 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
455 char **papszOptions =
nullptr)
override;
457 virtual char **GetFileList()
override;
460 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
462 int nBandCount,
int *panBandMap,
467 void GetBlockSize(
int *,
int *)
const;
471 return m_poPansharpener;
482 constexpr
double VRT_DEFAULT_NODATA_VALUE = -10000.0;
487 void ResetNoDataValues();
490 friend class VRTDataset;
492 int m_bIsMaskBand = FALSE;
494 int m_bNoDataValueSet = FALSE;
496 int m_bHideNoDataValue = FALSE;
497 double m_dfNoDataValue = VRT_DEFAULT_NODATA_VALUE;
499 bool m_bNoDataSetAsInt64 =
false;
500 int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
502 bool m_bNoDataSetAsUInt64 =
false;
503 uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
505 std::unique_ptr<GDALColorTable> m_poColorTable{};
509 char *m_pszUnitType =
nullptr;
510 char **m_papszCategoryNames =
nullptr;
512 double m_dfOffset = 0.0;
513 double m_dfScale = 1.0;
517 void Initialize(
int nXSize,
int nYSize);
519 std::vector<VRTOverviewInfo> m_aoOverviewInfos{};
521 VRTRasterBand *m_poMaskBand =
nullptr;
523 std::unique_ptr<GDALRasterAttributeTable> m_poRAT{};
527 bool IsNoDataValueInDataTypeRange()
const;
531 virtual ~VRTRasterBand();
534 std::map<CPLString, GDALDataset *> &);
535 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
562 const char *pszDomain =
"")
override;
564 const char *pszDomain =
"")
override;
566 virtual double GetOffset(
int *pbSuccess =
nullptr)
override;
568 virtual double GetScale(
int *pbSuccess =
nullptr)
override;
575 GUIntBig *panHistogram,
int bIncludeOutOfRange,
576 int bApproxOK, GDALProgressFunc,
577 void *pProgressData)
override;
580 int *pnBuckets,
GUIntBig **ppanHistogram,
581 int bForce, GDALProgressFunc,
582 void *pProgressData)
override;
589 virtual void GetFileList(
char ***ppapszFileList,
int *pnSize,
599 void SetMaskBand(VRTRasterBand *poMaskBand);
601 void SetIsMaskBand();
605 CPLErr UnsetNoDataValue();
607 virtual int CloseDependentDatasets();
609 virtual int IsSourcedRasterBand()
613 virtual int IsPansharpenRasterBand()
623 class VRTSimpleSource;
625 class CPL_DLL VRTSourcedRasterBand
CPL_NON_FINAL :
public VRTRasterBand
629 char **m_papszSourceList =
nullptr;
630 int m_nSkipBufferInitialization = -1;
632 bool CanUseSourcesMinMaxImplementations();
634 bool IsMosaicOfNonOverlappingSimpleSourcesOfFullRasterNoResAndTypeChange(
635 bool bAllowMaxValAdjustment)
const;
640 bool SkipBufferInitialization();
644 VRTSource **papoSources =
nullptr;
646 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand);
647 VRTSourcedRasterBand(
GDALDataType eType,
int nXSize,
int nYSize);
649 int nXSize,
int nYSize);
651 int nXSize,
int nYSize,
int nBlockXSizeIn,
653 virtual ~VRTSourcedRasterBand();
660 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
661 int nYSize,
int nMaskFlagStop,
662 double *pdfDataPct)
override;
664 virtual char **GetMetadataDomainList()
override;
665 virtual const char *GetMetadataItem(
const char *pszName,
666 const char *pszDomain =
"")
override;
667 virtual char **GetMetadata(
const char *pszDomain =
"")
override;
668 virtual CPLErr SetMetadata(
char **papszMetadata,
669 const char *pszDomain =
"")
override;
670 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
671 const char *pszDomain =
"")
override;
674 std::map<CPLString, GDALDataset *> &)
override;
675 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
677 virtual double GetMinimum(
int *pbSuccess =
nullptr)
override;
678 virtual double GetMaximum(
int *pbSuccess =
nullptr)
override;
679 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
680 double *adfMinMax)
override;
681 virtual CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
682 double *pdfMax,
double *pdfMean,
684 GDALProgressFunc pfnProgress,
685 void *pProgressData)
override;
686 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
687 GUIntBig *panHistogram,
int bIncludeOutOfRange,
688 int bApproxOK, GDALProgressFunc pfnProgress,
689 void *pProgressData)
override;
691 CPLErr AddSource(VRTSource *);
693 CPLErr AddSimpleSource(
const char *pszFilename,
int nBand,
694 double dfSrcXOff = -1,
double dfSrcYOff = -1,
695 double dfSrcXSize = -1,
double dfSrcYSize = -1,
696 double dfDstXOff = -1,
double dfDstYOff = -1,
697 double dfDstXSize = -1,
double dfDstYSize = -1,
698 const char *pszResampling =
"near",
702 double dfSrcYOff = -1,
double dfSrcXSize = -1,
703 double dfSrcYSize = -1,
double dfDstXOff = -1,
704 double dfDstYOff = -1,
double dfDstXSize = -1,
705 double dfDstYSize = -1,
706 const char *pszResampling =
"near",
709 CPLErr AddComplexSource(
const char *pszFilename,
int nBand,
710 double dfSrcXOff = -1,
double dfSrcYOff = -1,
711 double dfSrcXSize = -1,
double dfSrcYSize = -1,
712 double dfDstXOff = -1,
double dfDstYOff = -1,
713 double dfDstXSize = -1,
double dfDstYSize = -1,
714 double dfScaleOff = 0.0,
double dfScaleRatio = 1.0,
716 int nColorTableComponent = 0);
719 double dfSrcYOff = -1,
double dfSrcXSize = -1,
720 double dfSrcYSize = -1,
double dfDstXOff = -1,
721 double dfDstYOff = -1,
double dfDstXSize = -1,
722 double dfDstYSize = -1,
double dfScaleOff = 0.0,
723 double dfScaleRatio = 1.0,
725 int nColorTableComponent = 0);
728 double dfSrcYOff = -1,
double dfSrcXSize = -1,
729 double dfSrcYSize = -1,
double dfDstXOff = -1,
730 double dfDstYOff = -1,
double dfDstXSize = -1,
731 double dfDstYSize = -1);
736 void ConfigureSource(VRTSimpleSource *poSimpleSource,
738 double dfSrcXOff,
double dfSrcYOff,
double dfSrcXSize,
739 double dfSrcYSize,
double dfDstXOff,
double dfDstYOff,
740 double dfDstXSize,
double dfDstYSize);
742 void RemoveCoveredSources(
CSLConstList papszOptions =
nullptr);
744 virtual CPLErr IReadBlock(
int,
int,
void *)
override;
746 virtual void GetFileList(
char ***ppapszFileList,
int *pnSize,
747 int *pnMaxSize,
CPLHashSet *hSetFiles)
override;
749 virtual int CloseDependentDatasets()
override;
751 virtual int IsSourcedRasterBand()
override
756 virtual CPLErr FlushCache(
bool bAtClosing)
override;
763 class CPL_DLL VRTWarpedRasterBand final :
public VRTRasterBand
768 virtual ~VRTWarpedRasterBand();
770 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
772 virtual CPLErr IReadBlock(
int,
int,
void *)
override;
773 virtual CPLErr IWriteBlock(
int,
int,
void *)
override;
775 virtual int GetOverviewCount()
override;
782 class VRTPansharpenedRasterBand final :
public VRTRasterBand
784 int m_nIndexAsPansharpenedBand;
787 VRTPansharpenedRasterBand(
GDALDataset *poDS,
int nBand,
789 virtual ~VRTPansharpenedRasterBand();
791 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
793 virtual CPLErr IReadBlock(
int,
int,
void *)
override;
796 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
801 virtual int GetOverviewCount()
override;
804 virtual int IsPansharpenRasterBand()
override
809 void SetIndexAsPansharpenedBand(
int nIdx)
811 m_nIndexAsPansharpenedBand = nIdx;
813 int GetIndexAsPansharpenedBand()
const
815 return m_nIndexAsPansharpenedBand;
823 class VRTDerivedRasterBandPrivateData;
825 class CPL_DLL VRTDerivedRasterBand
CPL_NON_FINAL :
public VRTSourcedRasterBand
827 VRTDerivedRasterBandPrivateData *m_poPrivate;
828 bool InitializePython();
830 GetPixelFunctionArguments(
const CPLString &,
831 std::vector<std::pair<CPLString, CPLString>> &);
843 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand);
845 int nXSize,
int nYSize);
846 virtual ~VRTDerivedRasterBand();
853 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
854 int nYSize,
int nMaskFlagStop,
855 double *pdfDataPct)
override;
857 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
859 static CPLErr AddPixelFunction(
const char *pszFuncNameIn,
861 const char *pszMetadata);
863 static std::pair<PixelFunc, CPLString> *
864 GetPixelFunction(
const char *pszFuncNameIn);
866 void SetPixelFunctionName(
const char *pszFuncNameIn);
868 void SetPixelFunctionLanguage(
const char *pszLanguage);
871 std::map<CPLString, GDALDataset *> &)
override;
872 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
874 virtual double GetMinimum(
int *pbSuccess =
nullptr)
override;
875 virtual double GetMaximum(
int *pbSuccess =
nullptr)
override;
876 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
877 double *adfMinMax)
override;
878 virtual CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
879 double *pdfMax,
double *pdfMean,
881 GDALProgressFunc pfnProgress,
882 void *pProgressData)
override;
883 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
884 GUIntBig *panHistogram,
int bIncludeOutOfRange,
885 int bApproxOK, GDALProgressFunc pfnProgress,
886 void *pProgressData)
override;
888 static void Cleanup();
897 class CPL_DLL VRTRawRasterBand
CPL_NON_FINAL :
public VRTRasterBand
899 RawRasterBand *m_poRawRaster;
901 char *m_pszSourceFilename;
902 int m_bRelativeToVRT;
909 virtual ~VRTRawRasterBand();
912 std::map<CPLString, GDALDataset *> &)
override;
913 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
920 virtual CPLErr IReadBlock(
int,
int,
void *)
override;
921 virtual CPLErr IWriteBlock(
int,
int,
void *)
override;
923 CPLErr SetRawLink(
const char *pszFilename,
const char *pszVRTPath,
925 int nPixelOffset,
int nLineOffset,
926 const char *pszByteOrder);
932 char **papszOptions)
override;
934 virtual void GetFileList(
char ***ppapszFileList,
int *pnSize,
935 int *pnMaxSize,
CPLHashSet *hSetFiles)
override;
946 std::map<std::string, VRTSourceParser> m_oMapSourceParser{};
950 virtual ~VRTDriver();
952 char **papszSourceParsers;
955 virtual char **
GetMetadata(
const char *pszDomain =
"")
override;
957 const char *pszDomain =
"")
override;
960 ParseSource(
CPLXMLNode *psSrc,
const char *pszVRTPath,
961 std::map<CPLString, GDALDataset *> &oMapSharedSources);
962 void AddSourceParser(
const char *pszElementName, VRTSourceParser pfnParser);
969 class CPL_DLL VRTSimpleSource
CPL_NON_FINAL :
public VRTSource
975 std::map<CPLString, GDALDataset *> *m_poMapSharedSources =
nullptr;
985 void OpenSource()
const;
988 friend class VRTSourcedRasterBand;
989 friend class VRTDataset;
992 bool m_bGetMaskBand =
false;
994 double m_dfSrcXOff = 0;
995 double m_dfSrcYOff = 0;
996 double m_dfSrcXSize = 0;
997 double m_dfSrcYSize = 0;
999 double m_dfDstXOff = 0;
1000 double m_dfDstYOff = 0;
1001 double m_dfDstXSize = 0;
1002 double m_dfDstYSize = 0;
1006 int m_nMaxValue = 0;
1008 int m_bRelativeToVRTOri = -1;
1010 int m_nExplicitSharedStatus = -1;
1013 bool m_bDropRefOnSrcBand =
true;
1015 int NeedMaxValAdjustment()
const;
1019 return m_poRasterBand;
1029 VRTSimpleSource(
const VRTSimpleSource *poSrcSource,
double dfXDstRatio,
1030 double dfYDstRatio);
1031 virtual ~VRTSimpleSource();
1034 std::map<CPLString, GDALDataset *> &)
override;
1035 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1037 void SetSrcBand(
const char *pszFilename,
int nBand);
1040 void SetSrcWindow(
double,
double,
double,
double);
1041 void SetDstWindow(
double,
double,
double,
double);
1044 return m_osResampling;
1046 void SetResampling(
const char *pszResampling);
1048 int GetSrcDstWindow(
double,
double,
double,
double,
int,
int,
1049 double *pdfReqXOff,
double *pdfReqYOff,
1050 double *pdfReqXSize,
double *pdfReqYSize,
int *,
int *,
1051 int *,
int *,
int *,
int *,
int *,
int *,
1055 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1060 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1061 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1062 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
double dfMin,
1063 double dfMax,
int nBuckets,
1064 GUIntBig *panHistogram,
int bIncludeOutOfRange,
1065 int bApproxOK, GDALProgressFunc pfnProgress,
1066 void *pProgressData)
override;
1068 void DstToSrc(
double dfX,
double dfY,
double &dfXOut,
double &dfYOut)
const;
1069 void SrcToDst(
double dfX,
double dfY,
double &dfXOut,
double &dfYOut)
const;
1071 virtual void GetFileList(
char ***ppapszFileList,
int *pnSize,
1072 int *pnMaxSize,
CPLHashSet *hSetFiles)
override;
1074 virtual int IsSimpleSource()
override
1078 virtual const char *GetType()
1080 return "SimpleSource";
1082 virtual CPLErr FlushCache(
bool bAtClosing)
override;
1086 int IsSameExceptBandNumber(VRTSimpleSource *poOtherSource);
1088 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1090 int *panBandMap,
GSpacing nPixelSpace,
1094 void UnsetPreservedRelativeFilenames();
1096 void SetMaxValue(
int nVal)
1106 class VRTAveragedSource final :
public VRTSimpleSource
1110 int m_bNoDataSet =
false;
1114 VRTAveragedSource();
1116 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1121 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1122 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1123 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
double dfMin,
1124 double dfMax,
int nBuckets,
1125 GUIntBig *panHistogram,
int bIncludeOutOfRange,
1126 int bApproxOK, GDALProgressFunc pfnProgress,
1127 void *pProgressData)
override;
1129 void SetNoDataValue(
double dfNoDataValue);
1131 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1132 virtual const char *GetType()
override
1134 return "AveragedSource";
1146 VRT_SCALING_EXPONENTIAL,
1147 } VRTComplexSourceScaling;
1149 class CPL_DLL VRTComplexSource
CPL_NON_FINAL :
public VRTSimpleSource
1154 int m_bNoDataSet =
false;
1158 m_osNoDataValueOri{};
1160 VRTComplexSourceScaling m_eScalingType = VRT_SCALING_NONE;
1161 double m_dfScaleOff = 0;
1162 double m_dfScaleRatio = 1;
1165 int m_bSrcMinMaxDefined = FALSE;
1166 double m_dfSrcMin = 0;
1167 double m_dfSrcMax = 0;
1168 double m_dfDstMin = 0;
1169 double m_dfDstMax = 0;
1170 double m_dfExponent = 1;
1172 int m_nColorTableComponent = 0;
1174 bool m_bUseMaskBand =
false;
1176 double *m_padfLUTInputs =
nullptr;
1177 double *m_padfLUTOutputs =
nullptr;
1178 int m_nLUTItemCount = 0;
1180 double GetAdjustedNoDataValue()
const;
1182 template <
class WorkingDT>
1183 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
int nReqXSize,
1184 int nReqYSize,
void *pData,
int nOutXSize,
1192 VRTComplexSource(
const VRTComplexSource *poSrcSource,
double dfXDstRatio,
1193 double dfYDstRatio);
1194 virtual ~VRTComplexSource();
1197 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1202 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1203 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1204 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
double dfMin,
1205 double dfMax,
int nBuckets,
1206 GUIntBig *panHistogram,
int bIncludeOutOfRange,
1207 int bApproxOK, GDALProgressFunc pfnProgress,
1208 void *pProgressData)
override;
1210 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1212 std::map<CPLString, GDALDataset *> &)
override;
1213 virtual const char *GetType()
override
1215 return "ComplexSource";
1218 bool AreValuesUnchanged()
const;
1220 double LookupValue(
double dfInput);
1222 void SetNoDataValue(
double dfNoDataValue);
1224 void SetUseMaskBand(
bool bUseMaskBand)
1226 m_bUseMaskBand = bUseMaskBand;
1229 void SetLinearScaling(
double dfOffset,
double dfScale);
1230 void SetPowerScaling(
double dfExponent,
double dfSrcMin,
double dfSrcMax,
1231 double dfDstMin,
double dfDstMax);
1232 void SetColorTableComponent(
int nComponent);
1239 class VRTFilteredSource
CPL_NON_FINAL :
public VRTComplexSource
1247 int m_nSupportedTypesCount;
1250 int m_nExtraEdgePixels;
1253 VRTFilteredSource();
1254 virtual ~VRTFilteredSource();
1256 void SetExtraEdgePixels(
int);
1257 void SetFilteringDataTypesSupported(
int,
GDALDataType *);
1263 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1273 class VRTKernelFilteredSource
CPL_NON_FINAL :
public VRTFilteredSource
1282 double *m_padfKernelCoefs;
1287 VRTKernelFilteredSource();
1288 virtual ~VRTKernelFilteredSource();
1291 std::map<CPLString, GDALDataset *> &)
override;
1292 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1295 GByte *pabySrcData,
GByte *pabyDstData)
override;
1297 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs);
1298 void SetNormalized(
int);
1305 class VRTAverageFilteredSource final :
public VRTKernelFilteredSource
1310 explicit VRTAverageFilteredSource(
int nKernelSize);
1311 virtual ~VRTAverageFilteredSource();
1314 std::map<CPLString, GDALDataset *> &)
override;
1315 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1321 class VRTFuncSource final :
public VRTSource
1327 virtual ~VRTFuncSource();
1330 std::map<CPLString, GDALDataset *> &)
override
1334 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath)
override;
1337 int nXSize,
int nYSize,
void *pData,
int nBufXSize,
1342 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1343 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess)
override;
1344 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
double dfMin,
1345 double dfMax,
int nBuckets,
1346 GUIntBig *panHistogram,
int bIncludeOutOfRange,
1347 int bApproxOK, GDALProgressFunc pfnProgress,
1348 void *pProgressData)
override;
1362 #define TMP_CPL_DLL CPL_DLL
1377 explicit Ref(VRTGroup *ptr) : m_ptr(ptr)
1380 Ref(
const Ref &) =
delete;
1381 Ref &operator=(
const Ref &) =
delete;
1385 std::shared_ptr<Ref> m_poSharedRefRootGroup{};
1386 std::weak_ptr<Ref> m_poWeakRefRootGroup{};
1387 std::shared_ptr<Ref> m_poRefSelf{};
1389 std::string m_osFilename{};
1390 mutable bool m_bDirty =
false;
1391 std::string m_osVRTPath{};
1392 std::map<std::string, std::shared_ptr<VRTGroup>> m_oMapGroups{};
1393 std::map<std::string, std::shared_ptr<VRTMDArray>> m_oMapMDArrays{};
1394 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1395 std::map<std::string, std::shared_ptr<VRTDimension>> m_oMapDimensions{};
1397 std::shared_ptr<VRTGroup>
1398 OpenGroupInternal(
const std::string &osName)
const;
1399 void SetRootGroupRef(
const std::weak_ptr<Ref> &rgRef);
1400 std::weak_ptr<Ref> GetRootGroupRef()
const;
1403 VRTGroup(
const std::string &osParentName,
const std::string &osName);
1406 bool XMLInit(
const std::shared_ptr<VRTGroup> &poRoot,
1407 const std::shared_ptr<VRTGroup> &poThisGroup,
1408 const CPLXMLNode *psNode,
const char *pszVRTPath);
1410 std::vector<std::string>
1412 std::shared_ptr<GDALMDArray>
1416 std::vector<std::string>
1418 std::shared_ptr<GDALGroup>
OpenGroup(
const std::string &osName,
1421 return OpenGroupInternal(osName);
1424 std::vector<std::shared_ptr<GDALDimension>>
1427 std::vector<std::shared_ptr<GDALAttribute>>
1430 std::shared_ptr<VRTDimension> GetDimension(
const std::string &name)
const
1432 auto oIter = m_oMapDimensions.find(name);
1433 return oIter == m_oMapDimensions.end() ? nullptr : oIter->second;
1435 std::shared_ptr<VRTDimension>
1436 GetDimensionFromFullName(
const std::string &name,
bool bEmitError)
const;
1438 std::shared_ptr<GDALGroup>
1442 std::shared_ptr<GDALDimension>
1444 const std::string &osDirection,
GUInt64 nSize,
1447 std::shared_ptr<GDALAttribute>
1449 const std::vector<GUInt64> &anDimensions,
1454 const std::string &osName,
1455 const std::vector<std::shared_ptr<GDALDimension>> &aoDimensions,
1459 void SetIsRootGroup();
1461 const std::shared_ptr<Ref> &GetRef()
const
1465 VRTGroup *GetRootGroup()
const;
1467 const std::string &GetVRTPath()
const
1472 void SetFilename(
const std::string &osFilename)
1474 m_osFilename = osFilename;
1476 const std::string &GetFilename()
const
1478 return m_osFilename;
1480 bool Serialize()
const;
1481 CPLXMLNode *SerializeToXML(
const char *pszVRTPathIn)
const;
1482 void Serialize(
CPLXMLNode *psParent,
const char *pszVRTPathIn)
const;
1491 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1492 std::string m_osIndexingVariableName;
1495 VRTDimension(
const std::shared_ptr<VRTGroup::Ref> &poGroupRef,
1496 const std::string &osParentName,
const std::string &osName,
1497 const std::string &osType,
const std::string &osDirection,
1498 GUInt64 nSize,
const std::string &osIndexingVariableName)
1499 :
GDALDimension(osParentName, osName, osType, osDirection, nSize),
1500 m_poGroupRef(poGroupRef),
1501 m_osIndexingVariableName(osIndexingVariableName)
1505 VRTGroup *GetGroup()
const;
1507 static std::shared_ptr<VRTDimension>
1508 Create(
const std::shared_ptr<VRTGroup> &poThisGroup,
1509 const std::string &osParentName,
const CPLXMLNode *psNode);
1514 std::shared_ptr<GDALMDArray> poIndexingVariable)
override;
1526 std::vector<std::string> m_aosList{};
1527 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
1530 bool IRead(
const GUInt64 *arrayStartIdx,
const size_t *count,
1533 void *pDstBuffer)
const override;
1535 bool IWrite(
const GUInt64 *arrayStartIdx,
const size_t *count,
1538 const void *pSrcBuffer)
override;
1541 VRTAttribute(
const std::string &osParentName,
const std::string &osName,
1543 std::vector<std::string> &&aosList)
1546 m_aosList(std::move(aosList))
1548 if (m_aosList.size() > 1)
1550 m_dims.emplace_back(std::make_shared<GDALDimension>(
1551 std::string(),
"dim", std::string(), std::string(),
1556 VRTAttribute(
const std::string &osParentName,
const std::string &osName,
1563 m_dims.emplace_back(std::make_shared<GDALDimension>(
1564 std::string(),
"dim", std::string(), std::string(), nDim));
1568 static bool CreationCommonChecks(
1569 const std::string &osName,
const std::vector<GUInt64> &anDimensions,
1570 const std::map<std::string, std::shared_ptr<VRTAttribute>>
1573 static std::shared_ptr<VRTAttribute> Create(
const std::string &osParentName,
1576 const std::vector<std::shared_ptr<GDALDimension>> &
1594 class VRTMDArraySource
1597 virtual ~VRTMDArraySource() =
default;
1599 virtual bool Read(
const GUInt64 *arrayStartIdx,
const size_t *count,
1602 void *pDstBuffer)
const = 0;
1605 const char *pszVRTPath)
const = 0;
1615 friend class VRTGroup;
1617 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1618 std::string m_osVRTPath{};
1621 std::vector<std::shared_ptr<GDALDimension>> m_dims;
1622 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1623 std::vector<std::unique_ptr<VRTMDArraySource>> m_sources{};
1624 std::shared_ptr<OGRSpatialReference> m_poSRS{};
1625 std::vector<GByte> m_abyNoData{};
1626 std::string m_osUnit{};
1627 double m_dfScale = 1.0;
1628 double m_dfOffset = 0.0;
1629 bool m_bHasScale =
false;
1630 bool m_bHasOffset =
false;
1631 std::string m_osFilename{};
1633 bool IRead(
const GUInt64 *arrayStartIdx,
const size_t *count,
1636 void *pDstBuffer)
const override;
1642 const std::shared_ptr<VRTGroup::Ref> &poGroupRef,
1643 const std::string &osParentName,
const std::string &osName,
1645 std::vector<std::shared_ptr<GDALDimension>> &&dims,
1646 std::map<std::string, std::shared_ptr<VRTAttribute>> &&oMapAttributes)
1648 GDALMDArray(osParentName, osName), m_poGroupRef(poGroupRef),
1649 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()), m_dt(dt),
1650 m_dims(std::move(dims)), m_oMapAttributes(std::move(oMapAttributes)),
1651 m_osFilename(poGroupRef->m_ptr->GetFilename())
1655 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref> &poGroupRef,
1656 const std::string &osParentName,
const std::string &osName,
1657 const std::vector<std::shared_ptr<GDALDimension>> &dims,
1660 GDALMDArray(osParentName, osName), m_poGroupRef(poGroupRef),
1661 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()), m_dt(dt), m_dims(dims),
1662 m_osFilename(poGroupRef->m_ptr->GetFilename())
1673 return m_osFilename;
1676 static std::shared_ptr<VRTMDArray>
1677 Create(
const std::shared_ptr<VRTGroup> &poThisGroup,
1678 const std::string &osParentName,
const CPLXMLNode *psNode);
1680 const std::vector<std::shared_ptr<GDALDimension>> &
1686 std::vector<std::shared_ptr<GDALAttribute>>
1696 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override
1705 const std::string &
GetUnit()
const override
1710 bool SetUnit(
const std::string &osUnit)
override
1720 *pbHasOffset = m_bHasOffset;
1730 *pbHasScale = m_bHasScale;
1740 m_bHasOffset =
true;
1741 m_dfOffset = dfOffset;
1750 m_dfScale = dfScale;
1754 void AddSource(std::unique_ptr<VRTMDArraySource> &&poSource);
1756 std::shared_ptr<GDALAttribute>
1758 const std::vector<GUInt64> &anDimensions,
1764 GDALProgressFunc pfnProgress,
void *pProgressData)
override;
1766 void Serialize(
CPLXMLNode *psParent,
const char *pszVRTPathIn)
const;
1768 VRTGroup *GetGroup()
const;
1770 const std::string &GetVRTPath()
const
1780 class VRTMDArraySourceInlinedValues final :
public VRTMDArraySource
1782 const VRTMDArray *m_poDstArray =
nullptr;
1783 bool m_bIsConstantValue;
1784 std::vector<GUInt64> m_anOffset{};
1785 std::vector<size_t> m_anCount{};
1786 std::vector<GByte> m_abyValues{};
1787 std::vector<size_t> m_anInlinedArrayStrideInBytes{};
1790 VRTMDArraySourceInlinedValues(
const VRTMDArraySourceInlinedValues &) =
1792 VRTMDArraySourceInlinedValues &
1793 operator=(
const VRTMDArraySourceInlinedValues &) =
delete;
1796 VRTMDArraySourceInlinedValues(
const VRTMDArray *poDstArray,
1797 bool bIsConstantValue,
1798 std::vector<GUInt64> &&anOffset,
1799 std::vector<size_t> &&anCount,
1800 std::vector<GByte> &&abyValues)
1801 : m_poDstArray(poDstArray), m_bIsConstantValue(bIsConstantValue),
1802 m_anOffset(std::move(anOffset)), m_anCount(std::move(anCount)),
1803 m_abyValues(std::move(abyValues)), m_dt(poDstArray->GetDataType())
1805 const auto nDims(poDstArray->GetDimensionCount());
1806 m_anInlinedArrayStrideInBytes.resize(nDims);
1807 if (!bIsConstantValue && nDims > 0)
1809 m_anInlinedArrayStrideInBytes.back() =
1810 poDstArray->GetDataType().GetSize();
1811 for (
size_t i = nDims - 1; i > 0;)
1814 m_anInlinedArrayStrideInBytes[i] =
1815 m_anInlinedArrayStrideInBytes[i + 1] * m_anCount[i + 1];
1820 ~VRTMDArraySourceInlinedValues();
1822 static std::unique_ptr<VRTMDArraySourceInlinedValues>
1823 Create(
const VRTMDArray *poDstArray,
const CPLXMLNode *psNode);
1825 bool Read(
const GUInt64 *arrayStartIdx,
const size_t *count,
1828 void *pDstBuffer)
const override;
1830 void Serialize(
CPLXMLNode *psParent,
const char *pszVRTPath)
const override;
1837 class VRTMDArraySourceRegularlySpaced final :
public VRTMDArraySource
1840 double m_dfIncrement;
1843 VRTMDArraySourceRegularlySpaced(
double dfStart,
double dfIncrement)
1844 : m_dfStart(dfStart), m_dfIncrement(dfIncrement)
1848 bool Read(
const GUInt64 *arrayStartIdx,
const size_t *count,
1851 void *pDstBuffer)
const override;
1853 void Serialize(
CPLXMLNode *psParent,
const char *pszVRTPath)
const override;
1860 class VRTMDArraySourceFromArray final :
public VRTMDArraySource
1862 const VRTMDArray *m_poDstArray =
nullptr;
1863 bool m_bRelativeToVRTSet =
false;
1864 bool m_bRelativeToVRT =
false;
1865 std::string m_osFilename{};
1866 std::string m_osArray{};
1867 std::string m_osBand{};
1868 std::vector<int> m_anTransposedAxis{};
1869 std::string m_osViewExpr{};
1870 std::vector<GUInt64> m_anSrcOffset{};
1871 mutable std::vector<GUInt64> m_anCount{};
1872 std::vector<GUInt64> m_anStep{};
1873 std::vector<GUInt64> m_anDstOffset{};
1875 VRTMDArraySourceFromArray(
const VRTMDArraySourceFromArray &) =
delete;
1876 VRTMDArraySourceFromArray &
1877 operator=(
const VRTMDArraySourceFromArray &) =
delete;
1880 VRTMDArraySourceFromArray(
1881 const VRTMDArray *poDstArray,
bool bRelativeToVRTSet,
1882 bool bRelativeToVRT,
const std::string &osFilename,
1883 const std::string &osArray,
const std::string &osBand,
1884 std::vector<int> &&anTransposedAxis,
const std::string &osViewExpr,
1885 std::vector<GUInt64> &&anSrcOffset, std::vector<GUInt64> &&anCount,
1886 std::vector<GUInt64> &&anStep, std::vector<GUInt64> &&anDstOffset)
1887 : m_poDstArray(poDstArray), m_bRelativeToVRTSet(bRelativeToVRTSet),
1888 m_bRelativeToVRT(bRelativeToVRT), m_osFilename(osFilename),
1889 m_osArray(osArray), m_osBand(osBand),
1890 m_anTransposedAxis(std::move(anTransposedAxis)),
1891 m_osViewExpr(osViewExpr), m_anSrcOffset(std::move(anSrcOffset)),
1892 m_anCount(std::move(anCount)), m_anStep(std::move(anStep)),
1893 m_anDstOffset(std::move(anDstOffset))
1897 ~VRTMDArraySourceFromArray()
override;
1899 static std::unique_ptr<VRTMDArraySourceFromArray>
1900 Create(
const VRTMDArray *poDstArray,
const CPLXMLNode *psNode);
1902 bool Read(
const GUInt64 *arrayStartIdx,
const size_t *count,
1905 void *pDstBuffer)
const override;
1907 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:627
int GetShared() const
Returns shared flag.
Definition: gdaldataset.cpp:1530
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1875
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8834
virtual const std::string & GetUnit() const
Return the array unit.
Definition: gdalmultidim.cpp:2234
virtual std::shared_ptr< OGRSpatialReference > GetSpatialRef() const
Return the spatial reference system object associated with the array.
Definition: gdalmultidim.cpp:2262
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2424
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:205
Class used to represent potentially complex data types.
Definition: gdal_priv.h:2047
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:258
Class for dataset open functions.
Definition: gdal_priv.h:276
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:3005
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:2077
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2804
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2473
#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:3969
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7484
void * VRTDatasetH
Opaque type for a VRT dataset.
Definition: gdal_vrt.h:74
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:3216
virtual bool SetUnit(const std::string &osUnit)
Set the variable unit.
Definition: gdalmultidim.cpp:2212
virtual CPLErr AddBand(GDALDataType eType, char **papszOptions=nullptr)
Add a band to a dataset.
Definition: gdaldataset.cpp:708
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:8460
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:437
@ GDT_Unknown
Definition: gdal.h:65
Format specific driver.
Definition: gdal_priv.h:1693
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2385
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:6791
virtual double GetScale(bool *pbHasScale=nullptr, GDALDataType *peStorageType=nullptr) const
Get the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2602
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:3053
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:2335
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:586
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1586
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
GDALColorInterp
Definition: gdal.h:226
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:118
Convenient string class based on std::string.
Definition: cpl_string.h:311
A single raster band (or channel).
Definition: gdal_priv.h:1269
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:256
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:271
int GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:276
#define CPL_NON_FINAL
Mark that a class is explicitly recognized as non-final.
Definition: cpl_port.h:1044
CPLErr GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3800
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:2867
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4280
GDALDataType
Definition: gdal.h:63
Document node structure.
Definition: cpl_minixml.h:69
Definition: gdalwarper.h:493
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1874
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1767
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:2271
virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff, int nXSize, int nYSize, int nBandCount, const int *panBandList)
Return the compression formats that can be natively obtained for the window of interest and requested...
Definition: gdaldataset.cpp:9312
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:347
virtual std::vector< std::string > GetGroupNames(CSLConstList papszOptions=nullptr) const
Return the list of sub-groups contained in this group.
Definition: gdalmultidim.cpp:403
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff, int nYOff, int nXSize, int nYSize, int nBands, const int *panBandList, void **ppBuffer, size_t *pnBufferSize, char **ppszDetailedFormat)
Return the compressed content that can be natively obtained for the window of interest and requested ...
Definition: gdaldataset.cpp:9542
virtual CPLErr SetNoDataValueAsInt64(int64_t nNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1947
virtual int GetOverviewCount()
Return the number of overview layers available.
Definition: gdalrasterband.cpp:2558
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2697
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:6938
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS)
Assign a spatial reference system object to the array.
Definition: gdalmultidim.cpp:2248
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:7018
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:247
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1195
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:238
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:700
virtual std::shared_ptr< GDALGroup > CreateGroup(const std::string &osName, CSLConstList papszOptions=nullptr)
Create a sub-group within a group.
Definition: gdalmultidim.cpp:555
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1710
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1165
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1456
Ground Control Point.
Definition: gdal.h:1036
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:1365
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:3021
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1625
@ GCI_Undefined
Definition: gdal.h:228
virtual bool SetOffset(double dfOffset, GDALDataType eStorageType=GDT_Unknown)
Set the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2573
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Definition: gdalrasterband.cpp:2601
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:2404
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2959
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:290
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:4190
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3179
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:50
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:315
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:146
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1690
GDALAccess
Definition: gdal.h:124
virtual int64_t GetNoDataValueAsInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1746
virtual CPLErr SetNoDataValueAsUInt64(uint64_t nNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:2019
@ GA_ReadOnly
Definition: gdal.h:126
virtual std::shared_ptr< GDALMDArray > GetIndexingVariable() const
Return the variable that is used to index the dimension (if there is one).
Definition: gdalmultidim.cpp:8813
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:1060
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:235
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1298
virtual bool SetScale(double dfScale, GDALDataType eStorageType=GDT_Unknown)
Set the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2545
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:302
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:3058
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:6889
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:2910
GDALRWFlag
Definition: gdal.h:131
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:3454
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2379
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:513
Object with metadata.
Definition: gdal_priv.h:137
Pansharpening operation class.
Definition: gdalpansharpen.h:187
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:2586
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:1357
virtual CPLErr SetCategoryNames(char **papszNames)
Set the category names for this band.
Definition: gdalrasterband.cpp:1634
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:3306
virtual std::vector< std::string > GetMDArrayNames(CSLConstList papszOptions=nullptr) const
Return the list of multidimensional array names contained in this group.
Definition: gdalmultidim.cpp:353
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7343
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1244
virtual std::shared_ptr< GDALGroup > OpenGroup(const std::string &osName, CSLConstList papszOptions=nullptr) const
Open and return a sub-group.
Definition: gdalmultidim.cpp:428
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:7424
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Definition: gdal_rat.h:47
virtual const void * GetRawNoDataValue() const
Return the nodata value as a "raw" value.
Definition: gdalmultidim.cpp:2288
virtual std::shared_ptr< GDALMDArray > OpenMDArray(const std::string &osName, CSLConstList papszOptions=nullptr) const
Open and return a multidimensional array.
Definition: gdalmultidim.cpp:378
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
virtual CPLErr SetOffset(double dfNewOffset)
Set scaling offset.
Definition: gdalrasterband.cpp:2853
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:294
virtual double GetOffset(bool *pbHasOffset=nullptr, GDALDataType *peStorageType=nullptr) const
Get the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2632
VRTDatasetH VRTCreate(int, int)
Definition: vrtdataset.cpp:80
#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:1051
virtual uint64_t GetNoDataValueAsUInt64(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1807
A color table / palette.
Definition: gdal_priv.h:1120
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:519