Opened 9 years ago

Closed 9 years ago

#5840 closed defect (fixed)

Cannot SetProjection() in ERS driver.

Reported by: rolandhill Owned by: warmerdam
Priority: normal Milestone: 1.11.3
Component: GDAL_Raster Version: 1.11.0
Severity: normal Keywords: ers projection
Cc:

Description

Hi,

The SetProjection() method in the ERS driver contains some code at the end that will only write the requested projection into the header if it had not already been read during the Open() call. As the Create() method sets a default projection/datum ("Raw"), and you need to Open() the file before calling SetProjection(), SetProjection() becomes completely ineffectual (if I have understood it correctly).

You can create an ERS file with the desired projection by supplying options to the Create() method, but this would require special code to check if the format is ERS and isn't very efficient.

By changing:

    WriteProjectionInfo( (osProj.size()) ? osProj.c_str() : szERSProj,
                         (osDatum.size()) ? osDatum.c_str() : szERSDatum,
                         (osUnits.size()) ? osUnits.c_str() : szERSUnits );

to

    WriteProjectionInfo( szERSProj, szERSDatum, szERSUnits );

at the bottom of SetProjection() in ers/ersdataset.cpp the issue was resolved, but I am not sure why the original code was put there in the first place.

Using 1.11.0 (same in 1.11.1)

Regards,

Roland

Change History (2)

comment:1 by Even Rouault, 9 years ago

trunk r28474, branches/1.11 r28475 "ERS: fix SetProjection() (#5840)"

comment:2 by Even Rouault, 9 years ago

Milestone: 1.11.3
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.