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

Gregory Penn gregory.penn at gmail.com
Thu Oct 3 14:47:59 PDT 2013


I think that r.blend may accomplish what I need, in terms of compositing rasters to achieve the effect of partial transparency in a layer. It is not clear to me how this will work when one or more of the layers that I want to composite has rgb channels and so is represented by three separate raster maps (one for each channel) in the mapset. Do I need to create an image group (i.group) of the three channels and use the group's name as 'first' or 'second' parameter for r.blend?

The documentation for r.blend seems to indicate that it can only blend two rasters at a time.

> Message: 4
> Date: Thu, 3 Oct 2013 11:44:38 -0600
> From: Gregory Penn <gregory.penn at gmail.com>
> To: grass-user at lists.osgeo.org
> Subject: [GRASS-user] How to set layer opacity in maps created from
> 	command	line?
> Message-ID: <B66987DB-8098-4B6E-9282-6EB3B6CFCE7D at gmail.com>
> Content-Type: text/plain; charset=us-ascii
> 
> I am attempting to create maps from the command line, which are composites of several raster and vector layers. 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.
> 
> 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
> 
> 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?
> 
> ------------------------------
> 
> Message: 5
> Date: Thu, 03 Oct 2013 22:03:27 +0300
> From: Nikos Alexandris <nik at nikosalexandris.net>
> To: grass-user at lists.osgeo.org
> Cc: Gregory Penn <gregory.penn at gmail.com>
> Subject: Re: [GRASS-user] How to set layer opacity in maps created
> 	from	command line?
> Message-ID: <2374263.A5DhYUQC8g at resilience>
> Content-Type: text/plain; charset="us-ascii"
> 
> 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
> 
> 
> ------------------------------
> 
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> End of grass-user Digest, Vol 90, Issue 4
> *****************************************



More information about the grass-user mailing list