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
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to