[gdal-dev] GDAL_API_PROXY and deregistering drivers (python/win32) [SEC=UNCLASSIFIED]

Pinner, Luke Luke.Pinner at environment.gov.au
Thu May 23 00:18:44 PDT 2013


Greetings,

Following on from the GDAL 1.10 JP2000 Problem/Crash thread (http://osgeo-org.1560.x6.nabble.com/gdal-dev-GDAL-1-10-JP2000-Problem-Crash-td5054876.html), I'm trying to use the GDAL API Proxy and deregister the JP2ECW driver at runtime to avoid crashes with those Pleiades JP2s.  I'm stuck with the ERDAS ECW/JP2 v3.3 SDK at the moment due to the licensing of the v.4+ SDK and the need to support ECW on Linux.  However, deregistering fails when opening a dataset using the API Proxy.  Below is a simple test script that demonstrates this.

from osgeo import gdal
print gdal.__version__
gdal.UseExceptions()

f='img_phr1a_p_001/img_phr1a_p_201202250025599_sen_ipu_20120504_1737-002_r1c1.jp2'

gdal.AllRegister()

d=gdal.GetDriverByName('JP2ECW')
d.Deregister()
ds=gdal.Open(f)
print 'No PROXY:'+ds.GetDriver().GetDescription()
del ds;ds=None

gdal.AllRegister()

d=gdal.GetDriverByName('JP2ECW')
d.Deregister()
ds=gdal.Open('API_PROXY:'+f)
print 'API_PROXY:'+ds.GetDriver().GetDescription()
del ds;ds=None

This prints:
1.10.0
No PROXY:JP2OpenJPEG
API_PROXY:JP2ECW

I realise it's a bit of a dumb test, i.e. if gdal can open it, what's the problem...? But the crashes with this particular file are happening when running another operation after successfully opening the file. So what I was hoping to do was wrap a try: except: around the operation and if that fails, deregister the crappy (but much faster) ERDAS driver and fall back to the OpenJPEG driver.

Is there a workaround?

Regards,

Luke Pinner

If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130523/84ea768f/attachment.html>


More information about the gdal-dev mailing list