Opened 6 years ago

Closed 6 years ago

#4187 closed defect (fixed)

Open a .ecw with EPSG PCS/GCS code -1 fails

Reported by: bkrangnes Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: GDAL_Raster Version: 1.8.1
Severity: normal Keywords: EPSG -1 ECW SWIG Exception
Cc:

Description

We use Gdal 1-8-1 and the following code to open an .ecw file with :

OSGeo.GDAL.Gdal.Open(fileName, 0) The following error is returned:

“EPSG PCS/GCS code -1 not found in EPSG support files. Is this a valid EPSG coordinate system?”

Gdalinfo reports the following on the .ecw file: ERROR 6: EPSG PCS/GCS code -1 not found in EPSG support files. Is this a valid EPSG coordinate system?

When using an older version of gdal the .ecw file is opened ok.

Is -1 a valid code to use or is gdal not handling this correctly?

Change History (5)

comment:1 Changed 6 years ago by warmerdam

Status: newassigned

-1 is not a valid EPSG code, but it should not be a fatal error. The problem is that an error is issued, and the SWIG Bindings are throwing an exception even though the open actually worked. The usual way of dealing with this is to clear such errors when we don't want to treat them as serious.

I will try to fix this. Are you in a position to rebuild with a small code change? I can't think of any workaround.

comment:2 Changed 6 years ago by warmerdam

Keywords: ECW SWIG Exception added; in .ecw file removed

comment:3 Changed 6 years ago by warmerdam

Actually, to confirm, you are getting a fatal exception from the Open() method, right? Or were you just concerned about the reported runtime error? What language are you working in? Java?

comment:4 in reply to:  3 Changed 6 years ago by bkrangnes

Replying to warmerdam:

Actually, to confirm, you are getting a fatal exception from the Open() method, right? Or were you just concerned about the reported runtime error? What language are you working in? Java?

I get a fatal exception from the Open() method and use C#. I am not in a position to rebuild.

comment:5 Changed 6 years ago by Even Rouault

Milestone: 1.9.0
Resolution: fixed
Status: assignedclosed

r23321 /trunk/gdal/frmts/ecw/ecwdataset.cpp: ECW: allow to open a ECW file with invalid EPSG code from SWIG bindings (#4187)

Tested with a file produced with :

gdal_translate byte.tif foo.ecw -of ECW -outsize 128 128 -co PROJ=EPSG:-1  -a_srs "EPSG:-1"
Note: See TracTickets for help on using tickets.