Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alg/gdal_interpolateatpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool GDALInterpExtractValuesWindow(GDALRasterBand *pBand,
: BLOCK_SIZE;

#if 0
CPLDebug("RPC", "nY=%d nX=%d nBlockY=%d nBlockX=%d "
CPLDebug(GDAL_MDD_RPC, "nY=%d nX=%d nBlockY=%d nBlockX=%d "
"nFirstLineInCachedBlock=%d nFirstLineInOutput=%d nLinesToCopy=%d "
"nFirstColInCachedBlock=%d nFirstColInOutput=%d nColsToCopy=%d",
nY, nX, nBlockY, nBlockX, nFirstLineInCachedBlock, nFirstLineInOutput, nLinesToCopy,
Expand Down
44 changes: 24 additions & 20 deletions alg/gdal_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static void RPCTransformPoint(const GDALRPCTransformInfo *psRPCTransformInfo,
{
bWarned = true;
CPLDebug(
"RPC",
GDAL_MDD_RPC,
"Normalized %s for (lon,lat,height)=(%f,%f,%f) is %f, "
"i.e. with an absolute value of > 1, which may cause numeric "
"stability problems",
Expand All @@ -407,7 +407,7 @@ static void RPCTransformPoint(const GDALRPCTransformInfo *psRPCTransformInfo,
{
bWarned = true;
CPLDebug(
"RPC",
GDAL_MDD_RPC,
"Normalized %s for (lon,lat,height)=(%f,%f,%f) is %f, "
"ie with an absolute value of > 1, which may cause numeric "
"stability problems",
Expand All @@ -417,7 +417,7 @@ static void RPCTransformPoint(const GDALRPCTransformInfo *psRPCTransformInfo,
{
bWarned = true;
CPLDebug(
"RPC",
GDAL_MDD_RPC,
"Normalized %s for (lon,lat,height)=(%f,%f,%f) is %f, "
"i.e. with an absolute value of > 1, which may cause numeric "
"stability problems",
Expand All @@ -430,7 +430,8 @@ static void RPCTransformPoint(const GDALRPCTransformInfo *psRPCTransformInfo,
if (nCountWarningsAboutAboveOneNormalizedValues ==
MAX_ABS_VALUE_WARNINGS)
{
CPLDebug("RPC", "No more such debug warnings will be emitted");
CPLDebug(GDAL_MDD_RPC,
"No more such debug warnings will be emitted");
}
}
}
Expand Down Expand Up @@ -728,7 +729,7 @@ void *GDALCreateRPCTransformerV1(GDALRPCInfoV1 *psRPCInfo, int bReversed,
*
* Debugging of the RPC inverse transformer can be done
* by setting the RPC_INVERSE_VERBOSE configuration option to YES (in which case
* extra debug information will be displayed in the "RPC" debug category, so
* extra debug information will be displayed in the GDAL_MDD_RPC debug category, so
* requiring CPL_DEBUG to be also set) and/or by setting RPC_INVERSE_LOG to a
* filename that will contain the content of iterations (this last option only
* makes sense when debugging point by point, since each time
Expand Down Expand Up @@ -903,7 +904,8 @@ void *GDALCreateRPCTransformerV2(const GDALRPCInfoV2 *psRPCInfo, int bReversed,
}
else
{
CPLDebug("RPC", "Unknown interpolation %s. Defaulting to bilinear",
CPLDebug(GDAL_MDD_RPC,
"Unknown interpolation %s. Defaulting to bilinear",
pszDEMInterpolation);
psTransform->eResampleAlg = DRA_Bilinear;
}
Expand Down Expand Up @@ -1149,7 +1151,8 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,

if (psTransform->bRPCInverseVerbose)
{
CPLDebug("RPC", "Computing inverse transform for (pixel,line)=(%f,%f)",
CPLDebug(GDAL_MDD_RPC,
"Computing inverse transform for (pixel,line)=(%f,%f)",
dfPixel, dfLine);
}
VSILFILE *fpLog = nullptr;
Expand Down Expand Up @@ -1203,8 +1206,8 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
{
if (psTransform->poDS)
{
CPLDebug("RPC", "DEM (pixel, line) = (%g, %g)", dfDEMPixel,
dfDEMLine);
CPLDebug(GDAL_MDD_RPC, "DEM (pixel, line) = (%g, %g)",
dfDEMPixel, dfDEMLine);
}

// The first time, the guess might be completely out of the
Expand All @@ -1227,7 +1230,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
&dfDEMH))
{
bUseRefZ = false;
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Iteration %d for (pixel, line) = (%g, %g): "
"No elevation value at %.15g %.15g. "
"Using elevation %g at DEM (pixel, line) = "
Expand All @@ -1239,7 +1242,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
if (bUseRefZ)
{
dfDEMH = psTransform->dfRefZ;
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Iteration %d for (pixel, line) = (%g, %g): "
"No elevation value at %.15g %.15g. "
"Using elevation %g of reference point instead",
Expand All @@ -1249,7 +1252,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
}
else
{
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Iteration %d for (pixel, line) = (%g, %g): "
"No elevation value at %.15g %.15g. Erroring out",
iIter, dfPixel, dfLine, dfResultX, dfResultY);
Expand All @@ -1267,7 +1270,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,

if (psTransform->bRPCInverseVerbose)
{
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Iter %d: dfPixelDeltaX=%.02f, dfPixelDeltaY=%.02f, "
"long=%f, lat=%f, height=%f",
iIter, dfPixelDeltaX, dfPixelDeltaY, dfResultX, dfResultY,
Expand All @@ -1288,7 +1291,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
iIter = -1;
if (psTransform->bRPCInverseVerbose)
{
CPLDebug("RPC", "Converged!");
CPLDebug(GDAL_MDD_RPC, "Converged!");
}
break;
}
Expand All @@ -1300,7 +1303,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
// oscillate forever, so take a mean position as a new guess.
if (psTransform->bRPCInverseVerbose)
{
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Oscillation detected. "
"Taking mean of 2 previous results as new guess");
}
Expand All @@ -1326,7 +1329,7 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,
dfBoostFactor = 10;
if (psTransform->bRPCInverseVerbose)
{
CPLDebug("RPC", "Applying boost factor 10");
CPLDebug(GDAL_MDD_RPC, "Applying boost factor 10");
}
}

Expand Down Expand Up @@ -1361,8 +1364,9 @@ static bool RPCInverseTransformPoint(GDALRPCTransformInfo *psTransform,

if (iIter != -1)
{
CPLDebug("RPC", "Failed Iterations %d: Got: %.16g,%.16g Offset=%g,%g",
iIter, dfResultX, dfResultY, dfPixelDeltaX, dfPixelDeltaY);
CPLDebug(GDAL_MDD_RPC,
"Failed Iterations %d: Got: %.16g,%.16g Offset=%g,%g", iIter,
dfResultX, dfResultY, dfPixelDeltaX, dfPixelDeltaY);
return false;
}

Expand Down Expand Up @@ -1772,7 +1776,7 @@ static bool GDALRPCOpenDEM(GDALRPCTransformInfo *psTransform)
fabs(adfX[5] - dfRefLong) < 1.0e-12 &&
fabs(adfY[5] - dfRefLat) < 1.0e-12)
{
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Short-circuiting coordinate transformation "
"from DEM SRS to WGS 84 due to apparent nop");
delete psTransform->poCT;
Expand Down Expand Up @@ -1909,7 +1913,7 @@ int GDALRPCTransform(void *pTransformArg, int bDstToSrc, int nPointCount,
if (!bOnce)
{
bOnce = true;
CPLDebug("RPC",
CPLDebug(GDAL_MDD_RPC,
"Using GDALRPCTransformWholeLineWithDEM");
}
return GDALRPCTransformWholeLineWithDEM(
Expand Down
3 changes: 2 additions & 1 deletion alg/gdalgeoloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,8 @@ CPLStringList GDALCreateGeolocationMetadata(GDALDatasetH hBaseDS,
}

// Import the GEOLOCATION metadata from the geolocation dataset, if existing
auto papszGeolocMDFromGeolocDS = poGeolocDS->GetMetadata("GEOLOCATION");
auto papszGeolocMDFromGeolocDS =
poGeolocDS->GetMetadata(GDAL_MDD_GEOLOCATION);
if (papszGeolocMDFromGeolocDS)
aosMD = CSLDuplicate(papszGeolocMDFromGeolocDS);

Expand Down
16 changes: 8 additions & 8 deletions alg/gdalpansharpen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ GDALPansharpenOperation::Initialize(const GDALPansharpenOptions *psOptionsIn)
return CE_Failure;
aMSBands[i] = poVRTBand;
poVRTBand->SetNoDataValue(psOptions->dfNoData);
const char *pszNBITS =
poSrcBand->GetMetadataItem("NBITS", "IMAGE_STRUCTURE");
const char *pszNBITS = poSrcBand->GetMetadataItem(
GDALMD_NBITS, GDAL_MDD_IMAGE_STRUCTURE);
if (pszNBITS)
poVRTBand->SetMetadataItem("NBITS", pszNBITS,
"IMAGE_STRUCTURE");
poVRTBand->SetMetadataItem(GDALMD_NBITS, pszNBITS,
GDAL_MDD_IMAGE_STRUCTURE);

VRTSimpleSource *poSimpleSource = new VRTSimpleSource();
poVRTBand->ConfigureSource(
Expand Down Expand Up @@ -1305,11 +1305,11 @@ CPLErr GDALPansharpenOperation::ProcessRegion(int nXOff, int nYOff, int nXSize,
poMEMDS, i + 1, pabyBuffer, eWorkDataType, 0, 0, false);
poMEMDS->AddMEMBand(hMEMBand);

const char *pszNBITS =
aMSBands[i]->GetMetadataItem("NBITS", "IMAGE_STRUCTURE");
const char *pszNBITS = aMSBands[i]->GetMetadataItem(
GDALMD_NBITS, GDAL_MDD_IMAGE_STRUCTURE);
if (pszNBITS)
poMEMDS->GetRasterBand(i + 1)->SetMetadataItem(
"NBITS", pszNBITS, "IMAGE_STRUCTURE");
GDALMD_NBITS, pszNBITS, GDAL_MDD_IMAGE_STRUCTURE);

if (psOptions->bHasNoData)
poMEMDS->GetRasterBand(i + 1)->SetNoDataValue(
Expand Down Expand Up @@ -1484,7 +1484,7 @@ CPLErr GDALPansharpenOperation::ProcessRegion(int nXOff, int nYOff, int nXSize,
GDALRasterBand *poBand = aMSBands[i];
int nBandBitDepth = 0;
const char *pszNBITS =
poBand->GetMetadataItem("NBITS", "IMAGE_STRUCTURE");
poBand->GetMetadataItem(GDALMD_NBITS, GDAL_MDD_IMAGE_STRUCTURE);
if (pszNBITS)
nBandBitDepth = atoi(pszNBITS);
if (nBandBitDepth < nBitDepth)
Expand Down
7 changes: 4 additions & 3 deletions alg/gdalrasterize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ static CPLErr GDALRasterizeGeometriesInternal(
CPLStringList aosTransformerOptions;
GDALGeoTransform gt;
if (poDS->GetGeoTransform(gt) != CE_None && poDS->GetGCPCount() == 0 &&
poDS->GetMetadata("RPC") == nullptr)
poDS->GetMetadata(GDAL_MDD_RPC) == nullptr)
{
aosTransformerOptions.SetNameValue("DST_METHOD", "NO_GEOTRANSFORM");
}
Expand Down Expand Up @@ -1696,7 +1696,7 @@ CPLErr GDALRasterizeLayers(GDALDatasetH hDS, int nBandCount, int *panBandList,
{
if (poDS->GetSpatialRef() != nullptr ||
poDS->GetGCPSpatialRef() != nullptr ||
poDS->GetMetadata("RPC") != nullptr)
poDS->GetMetadata(GDAL_MDD_RPC) != nullptr)
{
CPLError(
CE_Warning, CPLE_AppDefined,
Expand All @@ -1716,7 +1716,8 @@ CPLErr GDALRasterizeLayers(GDALDatasetH hDS, int nBandCount, int *panBandList,
aosTransformerOptions.SetNameValue("SRC_SRS", pszProjection);
GDALGeoTransform gt;
if (poDS->GetGeoTransform(gt) != CE_None &&
poDS->GetGCPCount() == 0 && poDS->GetMetadata("RPC") == nullptr)
poDS->GetGCPCount() == 0 &&
poDS->GetMetadata(GDAL_MDD_RPC) == nullptr)
{
aosTransformerOptions.SetNameValue("DST_METHOD",
"NO_GEOTRANSFORM");
Expand Down
7 changes: 4 additions & 3 deletions alg/gdaltransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2507,8 +2507,8 @@ void *GDALCreateGenImgProjTransformer2(GDALDatasetH hSrcDS, GDALDatasetH hDstDS,
part.pTransformer = GDALTPSTransform;
}

else if ((pszMethod == nullptr || EQUAL(pszMethod, "RPC")) &&
(papszMD = GDALGetMetadata(hDS, "RPC")) != nullptr &&
else if ((pszMethod == nullptr || EQUAL(pszMethod, GDAL_MDD_RPC)) &&
(papszMD = GDALGetMetadata(hDS, GDAL_MDD_RPC)) != nullptr &&
GDALExtractRPCInfoV2(papszMD, &sRPCInfo))
{
CPLStringList aosOptions(papszOptions);
Expand Down Expand Up @@ -2539,7 +2539,8 @@ void *GDALCreateGenImgProjTransformer2(GDALDatasetH hSrcDS, GDALDatasetH hDstDS,
}

else if ((pszMethod == nullptr || EQUAL(pszMethod, "GEOLOC_ARRAY")) &&
((papszMD = GDALGetMetadata(hDS, "GEOLOCATION")) != nullptr ||
((papszMD = GDALGetMetadata(hDS, GDAL_MDD_GEOLOCATION)) !=
nullptr ||
pszGeolocArray != nullptr))
{
CPLStringList aosGeolocMD; // keep in this scope
Expand Down
2 changes: 1 addition & 1 deletion alg/gdalwarpoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static void SetAlphaMax(GDALWarpOptions *psOptions, GDALRasterBandH hBand,
const char *pszKey)
{
const char *pszNBits =
GDALGetMetadataItem(hBand, "NBITS", "IMAGE_STRUCTURE");
GDALGetMetadataItem(hBand, GDALMD_NBITS, GDAL_MDD_IMAGE_STRUCTURE);
const char *pszAlphaMax = nullptr;
if (pszNBits)
{
Expand Down
2 changes: 1 addition & 1 deletion apps/gdal_footprint_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ GDALDatasetH GDALFootprint(const char *pszDest, GDALDatasetH hDstDS,
{
CPLError(CE_Failure, CPLE_AppDefined,
"Input dataset has no raster band.%s",
poSrcDS->GetMetadata("SUBDATASETS")
poSrcDS->GetMetadata(GDAL_MDD_SUBDATASETS)
? " You need to specify one subdataset."
: "");
GDALFootprintOptionsFree(psOptionsToFree);
Expand Down
4 changes: 2 additions & 2 deletions apps/gdal_rasterize_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ static CPLErr ProcessLayer(OGRLayerH hSrcLayer, bool bSRSIsSet,

if (hDstSRS)
hDstSRS = OSRClone(hDstSRS);
else if (GDALGetMetadata(hDstDS, "RPC") != nullptr)
else if (GDALGetMetadata(hDstDS, GDAL_MDD_RPC) != nullptr)
{
hDstSRS = OSRNewSpatialReference(nullptr);
CPL_IGNORE_RET_VAL(
Expand Down Expand Up @@ -774,7 +774,7 @@ static CPLErr ProcessLayer(OGRLayerH hSrcLayer, bool bSRSIsSet,
CPLStringList aosTransformerOptions(CSLDuplicate(papszTO));
GDALGeoTransform gt;
if (poDS->GetGeoTransform(gt) != CE_None && poDS->GetGCPCount() == 0 &&
poDS->GetMetadata("RPC") == nullptr)
poDS->GetMetadata(GDAL_MDD_RPC) == nullptr)
{
aosTransformerOptions.SetNameValue("DST_METHOD", "NO_GEOTRANSFORM");
}
Expand Down
6 changes: 3 additions & 3 deletions apps/gdal_translate_bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ MAIN_START(argc, argv)
/* -------------------------------------------------------------------- */
if (!sOptionsForBinary.bCopySubDatasets &&
GDALGetRasterCount(hDataset) == 0 &&
CSLCount(GDALGetMetadata(hDataset, "SUBDATASETS")) > 0 &&
CSLCount(GDALGetMetadata(hDataset, GDAL_MDD_SUBDATASETS)) > 0 &&
// S104 and S111 drivers know how to handle a source dataset with subdatasets
// and no input bands.
!EQUAL(sOptionsForBinary.osFormat.c_str(), "S104") &&
Expand Down Expand Up @@ -207,7 +207,7 @@ MAIN_START(argc, argv)
nullptr);

if (sOptionsForBinary.bCopySubDatasets &&
CSLCount(GDALGetMetadata(hDataset, "SUBDATASETS")) > 0)
CSLCount(GDALGetMetadata(hDataset, GDAL_MDD_SUBDATASETS)) > 0)
{
if (bCopyCreateSubDatasets)
{
Expand All @@ -220,7 +220,7 @@ MAIN_START(argc, argv)
else
{
CSLConstList papszSubdatasets =
GDALGetMetadata(hDataset, "SUBDATASETS");
GDALGetMetadata(hDataset, GDAL_MDD_SUBDATASETS);
const int nSubdatasets = CSLCount(papszSubdatasets) / 2;
char *pszSubDest = static_cast<char *>(
CPLMalloc(strlen(sOptionsForBinary.osDest.c_str()) + 32));
Expand Down
Loading
Loading