[gdal-dev] Error writing/reading simple ENVI file

Calogero Mauceri mauceri at actgate.com
Fri Sep 11 04:01:16 PDT 2020


Thanks all for your feedback, now I understand the reason for the error.
Even thanks for the fix. I think it will be in place in the next GDAL
release, am I correct?

For the time being I'm using the GDAL_SKIP environment variable (thanks
Andrew for the hint) and it works.

Calogero

On Fri, Sep 11, 2020 at 11:58 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> On jeudi 10 septembre 2020 23:16:22 CEST jratike80 wrote:
>
> > Calogero Mauceri wrote
>
> >
>
> > > I'm not sure why it tries to open the ENVI file using the OpenJPEG
> reader.
>
> > > Anyway I'm using GDAL 2.4.4 and OpenJPEG 2.3.0. I tried GDAL 3.1.2,
> but I
>
> > > get the same error.
>
> >
>
> > GDAL is quessing the driver by the file name extension and starts trying
>
> > them one by one, in the order they appear in the list of supported
> drivers.
>
> > ENVI files are often named as .bsq, .bip, or .bil and then the guess is
>
> > usually right. However, .IMG is used by several other drivers as well.
>
>
>
> Actually most GDAL drivers avoid as much as possible relying on
> extensions, but rather on 'signatures' in file content. Of course with the
> ENVI driver where the filename passed for opening is the one of the raw
> raster content, there's no such signature, and thus this driver is tried
> after all other content-based drivers, because it has to detect the .hdr
> sidecar file as well.
>
> >
>
> > The JP2OpenJPEG driver may be too eager to open images with any name
>
> > extension. I modified your command a bit into
>
>
>
> The issue was actually true of several JPEG2000 capable drivers that can
> open a raw JPEG2000 codestream, and identified it with the first 2 bytes
> only. But actually the first 4 bytes are fixed, so in
>
> https://github.com/OSGeo/gdal/pull/2931 I detect them, which should
> considerably reduce the likelihood of false identification
>
>
>
> Even
>
>
>
> --
>
> Doing Open Source mostly as a greedy capitalist,
>
> as a hobbyist by accident at times.
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200911/de88d528/attachment.html>


More information about the gdal-dev mailing list