Opened 15 years ago

Last modified 15 years ago

#851 closed defect (fixed)

Large VRT to NITF fail to convert

Reported by: dimitri.monie@… Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: major Keywords:


I try to convert a .tif + .vrt file of 2.1 GB into NITF, and it fails with the
ERROR 3: Unable to read 65536 byte block from 846.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
Open GDAL Datasets:
  1 N NITF   41686x52222x1 /data/resources/tools/lib/gdal/tif2del/WCSTile_Full.ntf

The actual command is:
./gdal_translate -convert -quiet  -b 1 -srcwin 0 0 41686 52222 -outsize 41686
52222 -of NITF -s /data/WCSTile_Full.vrt -o /data/WCSTile_Full.ntf

Note that with a tif+vrt of 1.8 GB, the conversion succeeds.
Note that converting to JP2KAK instead on NITF succeeds.

Change History (2)

comment:1 Changed 15 years ago by warmerdam


I have confirmed the NITF driver uses the "small" file API and so can only
reliably produce files up to 2GB in size. 

The NITF format itself uses 32bit integers for file offsets, so it does not
seem that we can reliably go much larger than 4GB.  I am not sure if the NITF
spec indicates that the file offsets are signed or not.  I will need to do 
some investigation to determine that. 

So, it is relatively easy to change the NITF driver to use the large file API.
Treating offsets as 32bit unsigned may require some additional change.  But
ultimately I would be nervous about creating NITF files larger than 2GB as they
may not be well supported in other software packages. 

comment:2 Changed 15 years ago by warmerdam

I have updated the NITF driver to support reading and creating NITF files
in the 2-4GB size range and it seems to work ok.

Note: See TracTickets for help on using tickets.