[GRASSLIST:2186] Re: How to Display USGS DEM Files?

Tom Russo russo at swcp.com
Fri Jul 27 16:58:36 EDT 2001

Richard Shepard writes:
> I imported a USGS 24K DEM into GRASS5 using r.in.gdal. [...]
> all I see is a red rectangle[...]

I had the same problem.  There is apparently a problem with those DEMs where
the null values are set to huge negative numbers, screwing up the choice of
color map.

If you look at the GRASS FAQ web site there's a (somewhat outdated)
description of how to import USGS DEMs in SDTS format.  In there they describe
a procedure where you have to use sed to strip out the strange large negative
numbers.  In that procedure you use sdts2ascii to convert the stds file to
something GRASS can read (roughly) then edit it by hand and with sed to
massage it into something GRASS can read (actually).

As I recall, when I used r.in.gdal to do exactly what you're doing, I followed
the r.in.gdal run with r.out.ascii, then used a sed script to replace the
things like -32768 with 0.  If you dump out your raster file with r.out.ascii
and look at it for a few seconds it should be pretty obvious what to do to get
it fixed up.  

Once you get the strange large negatives out and re-import the DEM, the
colormap looks sane.

Now, there may well be a way to specify how the nulls are handled by r.in.gdal
or to process the raster file within GRASS, but I haven't figured it out yet.
Since I've already imported most of the DEMs I needed to work with and this
procedure works well enough for the odd ones I may have to import from time to
time, I have pretty much stopped trying to figure it out.

Tom Russo   KM5VY   QRPL #1592   K2#398     http://www.swcp.com/~russo/
Tijeras, NM DM64ux  SOC #236  ICQ#97201722  http://www.qsl.net/~km5vy/
 "Never put off until tomorrow what you can do today, because if you like it 
  today you can do it again tomorrow."

More information about the grass-user mailing list