[gdal-dev] Memory access violation with GDALGetRandomRasterSample and NITF/JPEG2000

Frank Warmerdam warmerdam at pobox.com
Thu Mar 4 17:33:39 EST 2010

Shaw, Jonathan-P29740 wrote:
> Is this a known problem for NITF or JPEG2000 files? Is there a way to
> see which JPEG2000 driver is used and to switch it to the other one? Any
> other suggestions?


The gdalinfo command should report the driver used for a file.  It's
the first piece of information reported.  Sometimes adding "--debug on"
can also be helpful to report details of what is going on internally.
For jpeg2000 in nitf you will need this to find out what jpeg2000 driver
is getting used for the jpeg2000 data stream.

The random sample function is likely setting a lot of views to get
bits of data which is terribly slow with any of the jpeg2000 drivers.
There was also a problem detected in some versions of the ecw library
that may be causing your problem.  It is documented at:


I have not made any effort to incorporate the fix into FWTools, and
I'm hesitant too.  The ECW support in OSGeo4W uses the latest DLLs
from Erdas and may not have the same problem, though I understand getting
the DLLs from Leica is not as easy as it used to be.

OSGeo4W does have good MrSID support (with the mrsid plugin) which
also gives jpeg2000 support.  You might aim for that instead of
depending on ECW jpeg2000 support.

It is also possible/likely that the JP2MrSID driver will actually
pull the samples from a high overview and be much faster than the full
res sampling that occurs with the ecw driver (due to an unfortunate
approach to overviews in the ecw driver I wrote).

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list