ERDAS to GRASS conversion

Mark Gibb gibb at vinny.cecer.army.mil
Thu Dec 3 17:02:51 EST 1992


To convert ERDAS LAN or GIS files into a GRASS raster files, the following
process can be followed:

For those of you who have been trying to convert ERDAS data into a GRASS format,
the following process might help you.  It is a long process, but it does acheive
the desired results.

First, you need to have the RDSRAST and WRSRAST data conversion modules on your
ERDAS program.  If you do not have these conversion modules, this process can
not be completed.  The first step is to convert your ERDAS GIS file into a 7.4
ERDAS format by using the CVT74 ERDAS program.  Next, run the LISTIT ERDAS
program on the 7.4 formatted GIS file.  The output will look something like the
following:


Header listing for GIS file: /USR/ERDAS75/TRAINDATA74/LNPUT.gis
Date statistics printed:  3-Dec-1992
Date statistics created:  1-Dec-1992

This file has 512 rows, and 512 columns

This image is geo-referenced to a UTM coordinate system
The upper left corner has coordinate: 233085, 3807070

The cell size is (X, Y): 30, 30
The number of acres per cell is: 0.2224021
Upper left corner data file coordinate (X,Y) is: 1, 1

Number of classes in this variable is: 10
This file contains 4-bit data

Make a listing of the Histogram? (Y,N) [Yes] : Yes

Make a listing of the Color Scheme? (Y,N) [Yes] : Yes


If possible, pipe the output of this LISTIT program to a printer for later use.
If this is not possible, be sure to record the following figures:


	1) The number of rows
	2) The number of columns
	3) The upper left corner corrdinate
	4) The cell size (similar to the GRASS program's resiolution)


The next step is to convert the ERDAS LAN or GIS file into a Sun Raster File.
This is accomplished by running the WRSRAST ERDAS program on the desired GIS
file.  This program will prompt you with the following:


Is this an Image or a GIS file?  (I,G) : GIS
Enter input GIS filename : /usr/erdas75/traindata74/lnput.gis
Enter SUN raster filename : lnput

You will be able to watch the program run using the rows and columns.
The next step is to export this Sun Raster File into your GRASS mapset
directory.  Next, enter the GRASS4.0 program.

The next step will have to be performed by the super user of your system.  The
GRASS4.0 r.in.sunrast program is only in the alpha testing stage and therefore
is not normally compiled with the GRASS4.0 program.  The r.in.sunrast program is
located in the /4.0/src.alpha/raster directory.  The program Gmakefile will have
to be run from this directory.  When compiled, this program will be stored in a
specific directory, so your individual .cshrc file will have to be altered to
include the search path where the compiled r.in.sunrast program is stored.  Next
run the following unix command :

	GRASS 4.0 > source ~/.cshrc

This will alter your search path without having to exit the program and logining in again.  Get into your main mapset directory by running cd $LOCATION. Now you
will be ready to run the r.in.sunrast program.  Simply type:

GRASS 4.0 > r.in.sunrast   and you will be prompted with the following:

OPTION:   Sun rasterfile to input
     key: input
required: YES
enter option > 

	Enter the name of the Sun Raster File created in ERDAS.  You will next
	be prompted with this statement:

You have chosen:
  input=lnputsrast
Is this correct? (y/n) [y]

	Answer yes.  You will be prompted with the following:


OPTION:   GRASS raster map to be created
     key: output
required: YES

Enter raster file name
Enter 'list' for a list of existing raster files
Hit RETURN to cancel request
> 

	Enter the name of the GRASS raster file you desire to be created.  You
	will next be prompted with a run quietly prompt.  Select the desired 
	option.  The following statement should appear next:


rasterfile is 512 rows by 512 columns
complete ...  100%


The numbers of rows and columns should appear that you recorded from the ERDAS 
LISTIT program output.  You now have created a GRASS raster file.  The next step
involves the reconfiguration of the cellhd file for the new raster file.  Since
a Sun Raster File is in x,y coordinates, the cellhd file for the raster file is
incorrect.  This example is for use in the UTM coordinate system.  Compute the
northing,southing,easting, and westing coordinates for the raster file by simply
following these steps:


1) The northing is the same y coordinate used for the uypper left corner
	coordinate in the ERDAS LISTIT output.  In this case, the northing is
	3807070 in UTM coordinates.

2)  The southing is computed by multiplying the number of rows by the cell size
	and subtracting this value from the northing.

	3807070 - (512 rows X 30)=
	3807070 - 15360 = 3791710  so 3791710 is the southing coordinate.

3) The easting is computed by multiplying the number of columns by the cell size
	and adding this value to the x coordinate of the upper left corner
	coordinate.

	233085 + (512 columns X 30)=
	233085 + 15360 = 248445 so 248445 is the easting coordinate.

4) The westing is simply the x coordinate of the upper left corner coordinate in
	ERDAS LISTIT output.  In this case, the westing is 233085 in UTM
	coordinates.

Next, run the GRASS program r.support, specifically editing the cell header
file.  Insert the above figures into the appropriate spot and make sure the
UTM zone is correct.  At this time, the category file can also be edited, since
the ERDAS annotated labels are not converted to a GRASS format in this process.

Good Luck!  I know this process is long, but I/ve tried to use the compiled
version of the src.alpha contributed program r.in.erdas, but I have been
unsuccessful.

Mark Gibb
USACERL Technical Assistance Center



More information about the grass-user mailing list