Skip to content

Commit 60543fc

Browse files
committed
ogr2ogr: output warning hinting when -relatedFieldNameMatch can be used
1 parent 7fc7f57 commit 60543fc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

apps/ogr2ogr_lib.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5391,10 +5391,31 @@ SetupTargetLayer::Setup(OGRLayer *poSrcLayer, const char *pszNewLayerName,
53915391
if (iDstField >= 0)
53925392
anMap[iField] = iDstField;
53935393
else
5394+
{
5395+
if (m_bExactFieldNameMatch)
5396+
{
5397+
const int iDstFieldCandidate = poDstLayer->FindFieldIndex(
5398+
poSrcFieldDefn->GetNameRef(), false);
5399+
if (iDstFieldCandidate >= 0)
5400+
{
5401+
CPLError(CE_Warning, CPLE_AppDefined,
5402+
"Source field '%s' could have been identified "
5403+
"with existing field '%s' of destination "
5404+
"layer '%s' if the -relaxedFieldNameMatch "
5405+
"option had been specified.",
5406+
poSrcFieldDefn->GetNameRef(),
5407+
poDstLayer->GetLayerDefn()
5408+
->GetFieldDefn(iDstFieldCandidate)
5409+
->GetNameRef(),
5410+
poDstLayer->GetName());
5411+
}
5412+
}
5413+
53945414
CPLDebug(
53955415
"GDALVectorTranslate",
53965416
"Skipping field '%s' not found in destination layer '%s'.",
53975417
poSrcFieldDefn->GetNameRef(), poDstLayer->GetName());
5418+
}
53985419
}
53995420
}
54005421

0 commit comments

Comments
 (0)