[GRASSLIST:7808] Re: d.legend not showing up in d.out.png

Michael Barton michael.barton at asu.edu
Sat Aug 6 17:14:50 EDT 2005

I just tried this on Lorenzo Moretti's 16 July 2005 binaries and had no
problem outputting a legend drawn on a map to a png file. I did a pretty
complex map with a color raster draped over a shaded relief map, several
vector layers, and a legend. I did them all in the GIS manager, liberally
using command layers (including for the legend).

What I suspect you are doing is drawing a map, then placing a legend on it
using your mouse. This won't work. I've listed the main 'guts' of d.out.png

#export display to PNG driver
dsave=`d.save -a`
d.mon start=PNG
eval "$dsave"
d.mon stop=PNG

As you can see, it uses the d.save command that writes a history of the
various d.* commands that have created a map display. It then starts the png
driver and reruns the commands saved with d.save. However, d.save can't
track your mouse movement. So the script tries to run d.legend but gets hung
up on the legend placement.

The best way to do this is using coordinates to place the legend. Once you
figure out where you want it, you can cut the command from the output window
of the GUI dialog box, paste it into a command box in the GIS Manager, and
save it with your other map display commands as a workspace file.

Hope this is helpful.


On 8/5/05 10:15 AM, "Dylan Beaudette" <dylan at iici.no-ip.org> wrote:

> Greetings,
> I have noticed in the last couple versions of GRASS 6.0 and 6.1 for linux and
> macos I have had problems saving the entire contents of a monitor with
> d.out.png. Specifically, a legend created with d.legend is not included in
> the output png file... however, everything else is there.
> does anyone know why this is happening?
> i have noticed that this has occurred in 3 such instances:
> 1. GRASS 6.1-CVS for linux-x86
> 2. GRASS 6.0 debian package for x-86
> 3. GRASS 6.0 / 6.1-CVS macos X package
> any ideas?
> thanks!

C. Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
PO Box 872402
Arizona State University
Tempe, AZ  85287-2402

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

More information about the grass-user mailing list