Skip to content

Commit

Permalink
Merge pull request #10935 from rouault/vrt_GDAL_OF_VERBOSE_ERROR
Browse files Browse the repository at this point in the history
VRT: use GDAL_OF_VERBOSE_ERROR flag in vrt:// and pansharpened modes
  • Loading branch information
rouault authored Oct 7, 2024
2 parents 057e3f8 + 28784ac commit 3f2c59b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 7 additions & 4 deletions frmts/vrt/vrtdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,9 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
// http://.jp2 file with the JP2OpenJPEG driver through the HTTP driver,
// which returns a /vsimem/ file
auto poSrcDS = std::unique_ptr<GDALDataset, GDALDatasetUniquePtrReleaser>(
GDALDataset::Open(osFilename, GDAL_OF_RASTER, aosAllowedDrivers.List(),
aosOpenOptions.List(), nullptr));
GDALDataset::Open(osFilename, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(),
nullptr));
if (poSrcDS == nullptr)
{
return nullptr;
Expand Down Expand Up @@ -1087,7 +1088,8 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
if (bFound)
{
poSrcDS.reset(GDALDataset::Open(
osSubdatasetSource.c_str(), GDAL_OF_RASTER,
osSubdatasetSource.c_str(),
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(),
nullptr));
if (poSrcDS == nullptr)
Expand Down Expand Up @@ -1142,7 +1144,8 @@ GDALDataset *VRTDataset::OpenVRTProtocol(const char *pszSpec)
}

poSrcDS.reset(GDALDataset::Open(
osSubdatasetSource.c_str(), GDAL_OF_RASTER,
osSubdatasetSource.c_str(),
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
aosAllowedDrivers.List(), aosOpenOptions.List(), nullptr));
if (poSrcDS == nullptr)
{
Expand Down
13 changes: 5 additions & 8 deletions frmts/vrt/vrtpansharpened.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,11 @@ CPLErr VRTPansharpenedDataset::XMLInit(const CPLXMLNode *psTree,
const CPLStringList aosOpenOptions(
GDALDeserializeOpenOptionsFromXML(psPanchroBand));

poPanDataset = GDALDataset::Open(osSourceFilename, GDAL_OF_RASTER,
poPanDataset = GDALDataset::Open(osSourceFilename,
GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
nullptr, aosOpenOptions.List());
if (poPanDataset == nullptr)
{
CPLError(CE_Failure, CPLE_AppDefined, "%s not a valid dataset",
osSourceFilename.c_str());
return CE_Failure;
}
poPanDatasetToClose = poPanDataset;
Expand Down Expand Up @@ -543,13 +542,11 @@ CPLErr VRTPansharpenedDataset::XMLInit(const CPLXMLNode *psTree,
const CPLStringList aosOpenOptions(
GDALDeserializeOpenOptionsFromXML(psIter));

poDataset = GDALDataset::Open(osSourceFilename, GDAL_OF_RASTER,
nullptr, aosOpenOptions.List());
poDataset = GDALDataset::Open(
osSourceFilename, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
nullptr, aosOpenOptions.List());
if (poDataset == nullptr)
{
CPLError(CE_Failure, CPLE_AppDefined,
"%s not a valid dataset",
osSourceFilename.c_str());
goto error;
}
oMapNamesToDataset[osSourceFilename] = poDataset;
Expand Down

0 comments on commit 3f2c59b

Please sign in to comment.