[GRASS5] problems with i.in.erdas in GRASS 5.3

Glynn Clements glynn.clements at virgin.net
Mon Jan 26 04:52:13 EST 2004


Glynn Clements wrote:

> > I just tried use i.in.erdas to read in a multiband *.lan file of 
> > LandsatTM images. It didn't work and produced the error listed below. 
> > With i.in.erdas out of commission, there seems to be no way to get 
> > multiband images into GRASS. I tried r.in.gdal (I have 1.1.9 installed) 
> > and it wouldn't read *.lan images or geotiffs in multiband format. Any 
> > suggestions?
> > 
> > I am using GRASS 5.3 (12 January 04 build) on a Mac OSX 10.2.8 system. 
> > The *.lan file is a version 7.4 format file of 7 Landsat TM bands, with 
> > a size of 375 Mb. Note below that it does recognize the file and read 
> > the header correctly.
> > 
> >   - - - i.in.erdas error - - -
> > 
> > Swapping Enabled
> > HEAD74
> > pack type ------------- 0 == 8 bit/pixel
> > number bands----------- 7
> > number cols,rows------- 7768, 7225
> > starting coordinate --- 1, 1
> > map type (int, float) - 1
> > number classes -------- 0
> > unit-type: ------------ N (N=None A=Acre H=Hectare O=Other)
> > area per pixel -------- 1.000000
> > map coordinate -------- 67089.500000, 4414792.500000
> > pixel size ------------ 28.500000, 28.500000
> > 
> > UTM coordinates used remember that the UTM zone is unknown
> > and must be set using the grass support function on the header file.
> > WARNING: G_set_fp_type() can only be called with FCELL_TYPE or 
> > DCELL_TYPE
> 
> i.in.erdas doesn't like the map type field, and appears not to like
> floating-point at all:
> 
> 	if(erdashd.maptyp == 0) /* integer data */
> 		data_type = CELL_TYPE;
> 	if(erdashd.maptyp == 99) { /* floating-point data */
> 		data_type = FCELL_TYPE;
> 		G_fatal_error("Floating point import doesn't work yet.");
> 	}
> 
> As neither of these two conditions are met, data_type ends up as -1,
> which isn't a valid map type.
> 
> Do you know how map type 1 differs from map type 0?

This is a bug which was introduced in:

----------------------------
revision 1.9
date: 2003/09/18 16:54:57;  author: markus;  state: Exp;  lines: +58 -23
added potential support for floating point maps, but I don't get the pixel values decoded, so still disabled.
----------------------------

[Note 5.0.0 to 5.0.3 inclusive all use revision 1.7 of this file, so
this only applies to 5.3.]

AFAICT, the maptyp field is actually the projection type:

	if ((erdashd.maptyp == 1) || (mapcoord->answer)) {
		if (set_uwindow(&erdashd,firstrow,lastrow,firstcol,lastcol) <0) {
			fprintf(stderr,"Error in setting GRASS window cordsn");
			exit(0);
		}
	}
	else
		if (set_window(firstrow,lastrow,firstcol,lastcol) <0) {
			fprintf(stderr,"Error in setting GRASS window cordsn");
			exit(0);
		}

[set_uwindow() is UTM, set_window() is XY.]

The code which I cited in my original reply should probably look like
this:

	if(erdashd.maptyp == 99) { /* floating-point data */
		data_type = FCELL_TYPE;
		G_fatal_error("Floating point import doesn't work yet.");
	}

	data_type = CELL_TYPE;

I've committed this to CVS.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list