Hi Peter,<br><br>As far as I understand, d.out.file only works with X monitors, the workflow for a PNG monitor would be as follows:<div><br></div><div>export GRASS_PNGFILE=test.png</div><div>export GRASS_WIDTH=800</div><div>export GRASS_HEIGHT=600</div><div>d.mon start=PNG</div><div>d.rast somerastermap</div><div>d.vect somevectormap</div><div>d.mon stop=PNG</div><div><br></div><div>You could do this entirely on the shell or on the script, but you must specify the PNG Driver variables before starting the PNG monitor.</div><div><br></div><div>This is what I tested with the PNG monitor:<br><br><div><span style="line-height:1.5">d.mon start=PNG</span><br></div><div>PNG: GRASS_TRUECOLOR status: TRUE</div><div>PNG: collecting to file: map.png,</div><div>GRASS_WIDTH=640, GRASS_HEIGHT=480</div><div>Graphics driver [PNG] started</div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">d.rast somerastermap</span><br></div><div><span style="line-height:1.5">d.vect somevectormap</span><br></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">./test.sh</span><br></div><div>Currently selected monitor: PNG</div><div>ERROR: Only X monitors are supported.</div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">d.mon stop=PNG</span><br></div><div>Monitor 'PNG' terminated</div></div><div><br></div><div>Please let me know if what you're trying to achieve with the PNG monitor differs from what I tried</div><br><div class="gmail_quote">El Tue Nov 11 2014 at 4:02:10 p. m., "Peter Löwe" <<a href="mailto:peter.loewe@gmx.de">peter.loewe@gmx.de</a>> escribió:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>Hi César,</div>

<div> </div>

<div>thanks for your follow-up work in this issue: That's exactly the workflow I was looking for. So the issue got already fixed between GRASS6.4.2 and 6.4.4. Could you please verify the behaviour of d.out.file in GRASS6.4.4 when a PNG monitor is being used ?</div>

<div> </div>

<div>Best,</div>

<div>Peter</div>

<div> </div>

<div><<a href="mailto:peter.loewe@gmx.de" target="_blank">peter.loewe@gmx.de</a>></div></div></div><div><div style="font-family:Verdana;font-size:12.0px">

<div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px;padding:10px 0 10px 10px;border-left:2px solid #c3d9e5;word-wrap:break-word">
<div name="quoted-content">Hello Peter,<br>
<br>
I'm sorry for misunderstanding your question, I thought that starting the monitor INSIDE the script would be adequate for you, I have tested this and couldn't reproduce your problem:
<div> </div>

<div>I created a test.sh file on my current directory and made it executable with the following contents:</div>

<div> </div>

<div>
<div>#!/bin/bash</div>

<div>d.mon -p</div>

<div>d.out.file output=test20141110 format=geotiff resolution=1 size=1440,720</div>
</div>

<div> </div>

<div>Then I started a monitor with some maps: d.mon x0, d.rast somerastermap, d.vect somevectormap</div>

<div> </div>

<div>Then I executed the script with ./test.sh</div>

<div> </div>

<div>I got this output:</div>

<div> </div>

<div>
<div>Currently selected monitor: x0</div>

<div>Saving display from Monitor: [x0] to <test20141110.tif>.</div>

<div>Image size [1440 x 720]</div>

<div> 100%</div>

<div>Screen export complete. (writing the file may take a small amount of time)</div>

<div>Image crop [720 x 720]</div>

<div>Waiting for file to write ...</div>

<div>Translating to GeoTIFF format</div>

<div>Done.</div>
</div>

<div> </div>

<div>I'm using GRASS 6.4.4 on Ubuntu 14.04 from ubuntugis PPA, let me now if I'm not testing it correctly</div>
 

<div class="gmail_quote">El Tue Nov 11 2014 at 11:03:24 a. m., "Peter Löwe" <<a href="http://peter.loewe@gmx.de" target="_blank">peter.loewe@gmx.de</a>> escribió:

<blockquote class="gmail_quote" style="margin:0 0 0 0.8ex;border-left:1.0px rgb(204,204,204) solid;padding-left:1.0ex">
<div>
<div style="font-family:Verdana;font-size:12.0px">
<div>Dear César, dear all,</div>

<div> </div>

<div>thanks for your input, but the core problem remains:</div>

<div> </div>

<div>When a Shell-script is invoked from the GRASS-shell (GRASS6.4.2 on Suse Linux on a HPC cluster) with a monitor (x0, PNG, etc.) being already activated (d.mon start / d.mon select), a g.gisenv _within_ the script will properly reference the active monitor ("MONITOR=x0"), BUT a "d.save -c" will throw a "WARNING: No socket to connect to for monitor" while "d.out.file" gives an "ERROR: no monitor selected".</div>

<div> </div>

<div>A feasible workaround would be to store the monitors content with d.save before running the script and recreating the content afterwards, but this is less than elegant. </div>

<div> </div>

<div>Suggestions, anyone ?</div>

<div> </div>

<div>Best,</div>

<div>Peter</div>

<div> </div>

<div> </div>

<div> </div>

<div><<a href="http://peter.loewe@gmx.de" target="_blank">peter.loewe@gmx.de</a>></div>

<div> 
<div> 
<div style="margin:10.0px 5.0px 5.0px 10.0px;padding:10.0px 0 10.0px 10.0px;border-left:2.0px solid rgb(195,217,229)">
<div>What I use on scripts is the PNG monitor setting the GRASS_PNGFILE, GRASS_HEIGHT and GRASS_WIDTH before starting the monitor.<br>
<br>
Take a look at the PNG Driver manual pages for more variables: <a href="http://grass.osgeo.org/grass64/manuals/pngdriver.html" target="_blank">http://grass.osgeo.org/grass64/manuals/pngdriver.html</a><br>
 
<div class="gmail_quote">El lun, 10 de noviembre de 2014 17:42, "Peter Löwe" <<a href="http://peter.loewe@gmx.de" target="_blank">peter.loewe@gmx.de</a>> escribió:

<blockquote class="gmail_quote" style="margin:0 0 0 0.8ex;border-left:1.0px rgb(204,204,204) solid;padding-left:1.0ex">Hi all,<br>
<br>
I'm trying call up d.out.file from within an add-on Shell-script for GRASS 6.>=4, but keep getting the following error:<br>
ERROR: No such monitor as <GRASS_MONITOR><br>
d.out.file output=test20141110 format=geotiff resolution=1 size=1440,720<br>
ERROR: You must select a display monitor.<br>
<br>
Let's assume that a GRASS monitor has been _started_ and _selected_ (x0, PNG, or similar) in the current GRASS session and some rasters and vectors have been drawn on it. Then, the script is invoked which needs to write out the content of the currently active monitor.<br>
<br>
Up till now neither a simple "export `g.gisenv`" or an explicit re-selecting the monitor via "d.mon select=$THECURRENTMONITOR" within the script improved the situation.<br>
<br>
Hints and suggestions would be greatly appreciated.<br>
<br>
 </blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div></div></div></blockquote></div>