Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2730 closed defect (fixed)

GenBin driver problems

Reported by: gaopeng Owned by: warmerdam
Priority: normal Milestone: 1.6.2
Component: GDAL_Raster Version: 1.6.0
Severity: normal Keywords: GenBin HFA


EIR driver crashes on one test image (tm4627_96.bil), and can open but returns wrong pixel values for another image (bil_ui01h.raw). Two sample images are at

Attachments (1)

bil_ui04h_sb.aux (16.2 KB ) - added by gaopeng 15 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 by warmerdam, 15 years ago

Cc: warmerdam added
Keywords: EIR added
Owner: changed from warmerdam to amilling

comment:2 by warmerdam, 15 years ago

Cc: warmerdam removed
Keywords: GenBin added; EIR removed
Owner: changed from amilling to warmerdam

Hi Frank,

Took a look at the sample files for Ticket 2730. Neither appears to be an EIR file. Both samples should be rejected because the header doesn't start with IMAGINE_RAW_FILE. Trying to figure out why they aren't getting rejected.

  • Adam

On review, I concur. The tm4627_96.bil/hdr file combination is actually using the GenBin driver, not the EIR driver as is the bil_ui01h.raw/bil_ui01h.hdr file combination. Reassigning back to myself, and reclassifying "GenBin".

Sorry Adam.

comment:3 by warmerdam, 15 years ago

Milestone: 1.6.1
Status: newassigned

The problem with the bil_ui01h.raw/bil_ui01h.hdr is that the DATATYPE is U1, which is not currently supported by the GenBin driver. It just assumes U8 (and issues a warning!) and continues. I'll implement U1 support.

comment:4 by warmerdam, 15 years ago

I have been unable to reproduce any problem (including running under valgrind) doing a gdal_translate of tm4627_96.bil to a new file.

comment:5 by warmerdam, 15 years ago

Milestone: 1.6.1

I have implemented support in the GenBin driver for U1 (bit) data in trunk (r16069) and 1.6 branch (r16071).

Still awaiting additional information on the problem with tm4627_96.bil.

comment:6 by gaopeng, 15 years ago

The crash on tm4627_96.bil is now non reproducible.

comment:7 by warmerdam, 15 years ago

Resolution: fixed
Status: assignedclosed

ok ... closing for now. Reopen if the problem remanifests.

comment:8 by gaopeng, 15 years ago

Resolution: fixed
Status: closedreopened

I have found the following three more issues:

  • U2 pixel type is not supported
  • U4 pixel type is not supported
  • U16 is supported but the returned pixel values are wrong

The sample datasets and screenshot are located at:

comment:9 by gaopeng, 15 years ago

Also the driver returns a prj string that ArcGIS can't read, see below for more details. Use bil_ui02h_sb.raw to reproduce.

* Gao,

I think it's the spheroid:


The inverse flattening value shouldn't be negative, and for Clarke 1866, it should be 294.9786982.


From: Peng Gao <pgao@…> To: Melita Kennedy <mkennedy@…> CC: Xiuguang Zhou <xzhou@…> Date: Mon, 2 Mar 2009 14:20:48 -0800 Subject: What's wrong with this pe string

Melita, ArcGIS can't create a valid SR from the following prj string. Could you check and see what's wrong with it?

Thanks, Gao


1866",DATUM["D_Clarke 1866",SPHEROID["Clarke_1866",6378206.4,-293.9786982138966]],PRIMEM["Greenwich",0 ],UNIT["Degree",0.017453292519943295]],PROJECTIONTransverse_Mercator,PARAMET ER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_fa ctor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UN IT["Meter",1]]

comment:10 by warmerdam, 15 years ago

I have implemented support for U2 and U4 files in trunk (r16464) and 1.6 branch (r16465). This patch also fixes a problem with negative state plane zone numbers.

The 16bit sample file provided has a .hdr file indicating INTEL byte order, but the actual raw file is bigendian, not intel byte order. I'm not sure what to do about this.

comment:11 by warmerdam, 15 years ago

Resolution: fixed
Status: reopenedclosed

Per a suggestion from Gao, I have adjusted the code to assume MSB unless the BYTE_ORDER is LSB. INTEL BYTE_ORDER gets treated as MSB by this logic. Changes in trunk (r16468) and 1.6 branch (r16469).

I think this covers outstanding issues, so I'm closing the ticket. Reopen if needed.

I should add that the inverse flattening/SRS issue was addressed in trunk (r16461) and 1.6 branch (r16462) though the conversation seems to have moved to #2755.

by gaopeng, 15 years ago

Attachment: bil_ui04h_sb.aux added

comment:12 by gaopeng, 15 years ago

Resolution: fixed
Status: closedreopened

One of dataset, bil_ui04h_sb.raw, has an associated aux, which contains an attribute table. The attribute values do not match the pixel values. The .aux is attached.

comment:13 by warmerdam, 15 years ago

Summary: EIR driver problemsGenBin driver problems

comment:14 by warmerdam, 15 years ago

Keywords: HFA added
Resolution: fixed
Status: reopenedclosed

Support for unique value binning for histograms and RATs has been implemented in trunk (r17462) and 1.6-esri (r17463) along with tests (r17461).

comment:15 by Even Rouault, 15 years ago

Frank, valgrind revealed 2 memory leaks in the new ReadHistogramMetadata() method. I've fixed them in trunk in r17465

comment:16 by gaopeng, 15 years ago

I tested and it fixed the problem.

About the field for the bin values. The name is "BinValues", the type is real, and the usage is MinMax. For unique value, the bin values are really single unique values, not a range, min/max, and it's always an integer value.

Can ti be changed to

poRAT->CreateColumn( "Value", GFT_Integer, GFU_Generic );

Also, could you port the memory leak fix to 1.6-esri ?

Thanks, Gao

comment:17 by warmerdam, 15 years ago

Above changes applied in trunk (r17467) and 1.6-esri (r17470).

Note: See TracTickets for help on using tickets.