Opened 15 years ago

Closed 15 years ago

#2817 closed defect (fixed)

bsb kap noaa

Reported by: bigiron Owned by: chaitanya
Priority: normal Milestone: 1.6.1
Component: GDAL_Raster Version: unspecified
Severity: critical Keywords: bsb noaa kap
Cc: warmerdam

Description

GDAL 1.5.1

I'm trying to read BSB files version 3.0 that I downloaded from the NOAA website. When I try to read the KAP file I get error:

Input file size is 10519, 9321 0...10...20...30...40...50...60...70...80...90 ERROR 1: Got scanline id 34 when looking for 9321 @ offset 4175254.

ERROR 1: IReadBlock failed at X offset 0, Y offset 9320 ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 9320

http://www.nauticalcharts.noaa.gov/mcd/Raster/download_agreement.htm

charts 12214 12216 12277 12304 12312 12316 12318

Change History (4)

comment:1 by warmerdam, 15 years ago

Cc: warmerdam added
Owner: changed from warmerdam to chaitanya

Could you review this one promptly? I suspect it is related to #2782 or other recent BSB fixes.

comment:2 by chaitanya, 15 years ago

Status: newassigned

Frank, I have some problems building 1.5.1 but I tested the charts listed above with the trunk. They worked fine.

However, they do have one less row than listed in the header. Even the charts not listed above have one less row than listed in header. The only difference I could find was that in the listed charts the offset of the first line 'looks' like a smaller scanline id than expected.

comment:3 by warmerdam, 15 years ago

Chaitanya,

Could you test against 1.6.0 as well then and see if this is something fixed since then?

Assuming you can confirm it was broken and is now fixed then you can close this ticket as fixed or worksforme.

comment:4 by Even Rouault, 15 years ago

Milestone: 1.6.1
Resolution: fixed
Status: assignedclosed

I confirm Chaitanya's analysis that this NOAA charts have one less row than advertized in the header. It happens I've fixed that while integrating Chaitanya's patch for #2782. So the situation is that they don't work for GDAL <= 1.6.0, but will work in GDAL 1.6.1 and 1.7.0.

See following snippet in bsb_read.c :

        /* For some charts, like 1115A_1.KAP, coming from */
        /* http://www.nauticalcharts.noaa.gov/mcd/Raster/index.htm, */
        /* the index table can have one row less than nYSize */
        /* If we look into the file closely, there is no data for */
        /* that last row (the end of line psInfo->nYSize - 1 is the start */
        /* of the index table), so we can decrement psInfo->nYSize */
        if (nOffsetIndexTable + 4 * (psInfo->nYSize - 1) == nFileLen - 4)
        {
            CPLDebug("BSB", "Index size is one row shorter than declared image height. Correct this");
            psInfo->nYSize --;
        }
Note: See TracTickets for help on using tickets.