[gdal-dev] Re: Byte swapping (esp for ENVI format output) & RSAT2 doc

Frank Warmerdam warmerdam at pobox.com
Fri Jun 6 13:10:58 EDT 2008


Paul Mallas wrote:
> Thanks for the note - I went ahead and wrote a small c++ program to do 
> this.
> Pretty easy to implement, but it seemed like something that would be in 
> the gdal utilities.
> 
> Christopher Barker wrote:
>>
>>
>>> Paul Mallas wrote:
>>>> Does any gdal utility (like gdal_translate) have the capacity to 
>>>> byte swap data, especially for the ENVI output format?
>>
>> I don't know if there is a way for GDAL to do it, but it would be a 
>> pretty short scrip tin python with numpy -- load the rasterband into a 
>> numpy array, byteswap it, then save it back.

Paul,

If you prepare a VRT file description of a raw file you can describe
the byte order of the data.  Some of the other "raw file header" formats
also include byte order information.

   http://www.gdal.org/gdal_vrttut.html (scan for "Descriptions for raw files")

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list