Skip to content

Commit 965aa69

Browse files
committed
IK-82 - try to convert from GCP to GeoTransform, with looser tolerances (ApproxOK = True) (if we have GCP)
1 parent 34e3876 commit 965aa69

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/Image/GdalRaster.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,19 @@ bool GdalRaster::ReadGeoTransform()
362362
double adfGeoTransform[6];
363363
bool success = _dataset->GetGeoTransform(adfGeoTransform) == CE_None;
364364

365+
if (!success) {
366+
// IK-82, try to convert from GCP to GeoTransform, with looser tolerances (ApproxOK = True) (if we have GCP)
367+
auto count = _dataset->GetGCPCount();
368+
if (count > 0)
369+
{
370+
auto gcps = _dataset->GetGCPs();
371+
success = CPL_TO_BOOL(GDALGCPsToGeoTransform(count, gcps, adfGeoTransform, TRUE));
372+
CString sOutput;
373+
sOutput.AppendFormat("GDALGCPsToGeoTransform(%d,..,TRUE): return: %s\r\n", count, success ? "true" : "false");
374+
::OutputDebugStringA(sOutput.GetBuffer());
375+
}
376+
}
377+
365378
m_globalSettings.SetGdalUtf8(false);
366379

367380
if (!success) return false;

src/Ogr/OgrConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ OGRGeometry* OgrConverter::ShapeToGeometry(IShape* shape, OGRwkbGeometryType for
120120
long beg_part, end_part;
121121
ShpfileType shptype;
122122
double x,y,z,m;
123-
123+
124124
shp->get_ShapeType(&shptype);
125125
shp->get_NumParts(&numParts);
126126
shp->get_NumPoints(&numPoints);

0 commit comments

Comments
 (0)