Erdas to grass conversion
grass
grass%alla at amber.cecer.army.mil
Wed May 20 08:44:50 EDT 1992
Erdas .gis files have a 128 byte header at the front of the file that contains
the information pertaining to rows, cols, coordinate system etc. The rest of thefile follows also in 128 byte 'rows' and the last row is filled making the file slightly larger than rows*cols.
Erdas image files are set in a BIL format 'Band Interleaved by Line', also in a 128 byte 'rows'.
the .gis files can be converted to gras by stripping off the header and
reblocking the file.
The only way I've found to deal with multiple band image files is to subset themout to their individual bands and convert the bands seperately. The informationfrom the ERDAS command LISTIT is helpfull in providing the rows and cols and
color information .
after the gis file is converted r.support must be run on it to make it complete.
I've included a short file that convert erdas .gis files to a grass cell file
without support
this works for erdas .gis 8bit files.
dd if=$1.gis ibs=128 skip=1 of=tmp.tmp obs=$2
dd if=tmp.tmp of=$1 bs=$2 count=$3
rm -f tmp.tmp
where $1 is the name of the .gis file without the .gis extension
$2 is the number of cols
$3 is the number of rows
for 16bit single band (DEM) files
rows=`expr \( 2 \* $3 \)`
dd if=$1.lan ibs=128 skip=1 of=tmp.tmp obs=$2
dd if=tmp.tmp of=tmp2.tmp bs=$2 conv=swab
rm -f tmp.tmp
dd if=tmp2.tmp of=$1 bs=$2 count=$rows
rm -f tmp2.tmp
the conv=swab is not always needed. it depends on the data
I know these are clumsey but they work
and they are not too slow
any improvements would be appreciated
Tom Nelson
U.S. Army COE
Fort Worth Texas
More information about the grass-user
mailing list