[GRASS-user] How to set layer opacity in maps created from command line?

Nikos Alexandris nik at nikosalexandris.net
Thu Oct 3 12:03:27 PDT 2013


On Thursday 03 of October 2013 11:44:38 Gregory Penn wrote:

> I am attempting to create maps from the command line, which are composites
> of several raster and vector layers.

Working on GRASS 6.x or 7?


> In order to visualize the data effectively, I need to vary the opacity of
> the layers. I have found that this is simple to achieve in the wxGUI, but
> the GUI does not display the underlying module call as it does with many
> other commands. A little Googling helped me to discover a module called
> g.pnmcomp, which was apparently used by the old Tcl/Tk GUI for managing 
> layer opacity, but that module appears not to be intended for end users and
> I suspect that there is an easier and more direct way to achieve my desired
> results.

Check r.blend: <http://grass.osgeo.org/grass64/manuals/r.blend.html>, 
<http://grass.osgeo.org/grass70/manuals/r.blend.html>.  The latter features a 
"-c" flag, which does... "Combine resulting R,G,B layers into single output 
map".


> The process by which I'm creating my maps is essentially this sequence of
> commands (is there a better approach?):
> 
> g.region rast=region_raster.tif
> d.mon start=PNG
> d.rast map=some_raster.tif
> d.rast map=another_raster.tif
> d.vect map=some_vector.shp
> d.mon stop=PNG

Ah, this is GRASS6.x then. I think you can still blend maps and then maybe use 
d.out.png to export?  See 
<http://grass.osgeo.org/grass64/manuals/d.out.png.html>.


> It seems to me that either d.mon or the PNG driver is doing the compositing
> and so would handle the opacity of the layers, but I can't find any
> documentation of how to specify values for opacity. This is surprising to
> me because it seems that what I'm trying to do is such a basic and commonly
> used operation in creating maps. What am I missing?

Hope this is what you are looking for.

Nikos


More information about the grass-user mailing list