Ticket #2132 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Golden Software Surfer 7 Georeferencing is incorrect

Reported by: ReedC Assigned to: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc: dron

Description

Last year, a changeset was submitted which fixed the golden software 6 file formats (10814), but unfortunately it wasn't applied to the surfer 7 file format which has the exact same issue.

This can be fixed by replacing the GetGeoTransform? method in frmts/gsg/gs7bgdataset.cpp with the following snippet:

/************************************************************************/
/*                          GetGeoTransform()                           */
/************************************************************************/

CPLErr GS7BGDataset::GetGeoTransform( double *padfGeoTransform )
{
    if( padfGeoTransform == NULL )
        return CE_Failure;

    GS7BGRasterBand *poGRB = (GS7BGRasterBand *)GetRasterBand( 1 );

    if( poGRB == NULL )
    {
        padfGeoTransform[0] = 0;
        padfGeoTransform[1] = 1;
        padfGeoTransform[2] = 0;
        padfGeoTransform[3] = 0;
        padfGeoTransform[4] = 0;
        padfGeoTransform[5] = 1;
        return CE_Failure;
    }

    /* check if we have a PAM GeoTransform stored */
    CPLPushErrorHandler( CPLQuietErrorHandler );
    CPLErr eErr = GDALPamDataset::GetGeoTransform( padfGeoTransform );
    CPLPopErrorHandler();

    if( eErr == CE_None )
        return CE_None;

    /* calculate pixel size first */
    padfGeoTransform[1] = (poGRB->dfMaxX - poGRB->dfMinX)/(nRasterXSize - 1);
    padfGeoTransform[5] = (poGRB->dfMinY - poGRB->dfMaxY)/(nRasterYSize - 1);

    /* then calculate image origin */
    padfGeoTransform[0] = poGRB->dfMinX - padfGeoTransform[1] / 2;
    padfGeoTransform[3] = poGRB->dfMaxY - padfGeoTransform[5] / 2;

    /* tilt/rotation does not supported by the GS grids */
    padfGeoTransform[4] = 0.0;
    padfGeoTransform[2] = 0.0;


    return CE_None;
}

Attachments

geogeotransform.cpp (1.5 kB) - added by ReedC on 01/04/08 17:21:19.
Code to fix issue

Change History

01/04/08 17:21:19 changed by ReedC

  • attachment geogeotransform.cpp added.

Code to fix issue

01/07/08 08:52:11 changed by dron

  • status changed from new to closed.
  • cc set to dron.
  • resolution set to fixed.

Thanks for the patch, I have applied the fix both in trunk (r13479) and 1.5 branches (r13480).

Best regards, Andrey