[gdal-dev] Reading signed 8-bit Erdas Imagine .img (HFA driver)

Frank Warmerdam warmerdam at pobox.com
Tue Sep 1 23:05:24 EDT 2009

Jason Roberts wrote:
>>>> band.GetMetadata()
> {'LAYER_TYPE': 'athematic', 'STATISTICS_MAXIMUM': '126',
> 'STATISTICS_MINIMUM': '-127', 'STATISTICS_STDDEV': '109.55249883047',
> 'STATISTICS_HISTOBINVALUES': '3|3|', 'STATISTICS_MEAN': '-0.33333333333333',
> 'STATISTICS_MODE': '6.2891288834462e-247', 'STATISTICS_MEDIAN':
> '6.2896744699688e-247'}
> As you can see, there is no PIXELTYPE metadata entry for the band. Is that
> entry only created when GDAL creates the file? In any case, it is possible
> to detect that the true values fit in the int8 range, not the uint8 range:


The PIXELTYPE metadata is in the IMAGE_STRUCTURE domain, so you need to
fetch it like:

   md = band.GetMetadata('IMAGE_STRUCTURE')

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list