[GRASS5] [bug #3011] (grass) d.mon CELL doesn't work

Glynn Clements glynn at gclements.plus.com
Tue Oct 25 15:28:37 EDT 2005


Hamish wrote:

> > But I can't think of a reason why you would want a monitor image as a 
> > GRASS raster; rather I would put it that it is the CELL driver that 
> > requires two images to get to an output graphics file.
> ..
> > It makes it easy to convert a monitor image into a GRASS raster, but
> > what  use is it once you've got it there? I feel it is an historical 
> > anachronism.
> 
> for the record, an example and work around for this situation.
> 
> ps.map will only take one raster for an input image. recently I wanted
> to create a hard copy which overlayed one raster image over another
> (land+sea satellite images butted up against each other using NULLs).
> Each raster had its own unreconcilable color table so I couldn't use
> r.patch, and using both the 'rgb' and 'raster' ps.map commands still
> would only let me show one raster.

Yep; "masked" images are a relatively new feature, only available in
PostScript level 3.

> The solution was to set GRASS_WIDTH and GRASS_HEIGHT to the rows &
> columns given by g.region, use the PNG driver to dump to a 24-bit image,
> reload that rather large image with r.in.gdal, reset the imported maps'
> bounds with r.region (trivial as it matched the originial region), then
> use d.rgb and ps.map's "rgb" command to display the whole thing. Having
> a CELL driver might have made it slightly easier, but more obscure to
> use and not useful enough to justify maintaining the code IMO.

I would have thought it easier to do:

	r.mapcalc <<EOF
	  out.r = if(isnull(top),r#bottom,r#top)
	  out.g = if(isnull(top),g#bottom,g#top)
	  out.b = if(isnull(top),b#bottom,b#top)
	EOF

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list