Hi Peter, As far as I understand, d.out.file only works with X monitors, the workflow for a PNG monitor would be as follows:
export GRASS_PNGFILE=test.png export GRASS_WIDTH=800 export GRASS_HEIGHT=600 d.mon start=PNG d.rast somerastermap d.vect somevectormap d.mon stop=PNG 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. This is what I tested with the PNG monitor: d.mon start=PNG PNG: GRASS_TRUECOLOR status: TRUE PNG: collecting to file: map.png, GRASS_WIDTH=640, GRASS_HEIGHT=480 Graphics driver [PNG] started d.rast somerastermap d.vect somevectormap ./test.sh Currently selected monitor: PNG ERROR: Only X monitors are supported. d.mon stop=PNG Monitor 'PNG' terminated Please let me know if what you're trying to achieve with the PNG monitor differs from what I tried El Tue Nov 11 2014 at 4:02:10 p. m., "Peter Löwe" <[email protected]> escribió: > Hi César, > > 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 ? > > Best, > Peter > > <[email protected]> > Hello Peter, > > 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: > > I created a test.sh file on my current directory and made it executable > with the following contents: > > #!/bin/bash > d.mon -p > d.out.file output=test20141110 format=geotiff resolution=1 size=1440,720 > > Then I started a monitor with some maps: d.mon x0, d.rast somerastermap, > d.vect somevectormap > > Then I executed the script with ./test.sh > > I got this output: > > Currently selected monitor: x0 > Saving display from Monitor: [x0] to <test20141110.tif>. > Image size [1440 x 720] > 100% > Screen export complete. (writing the file may take a small amount of time) > Image crop [720 x 720] > Waiting for file to write ... > Translating to GeoTIFF format > Done. > > I'm using GRASS 6.4.4 on Ubuntu 14.04 from ubuntugis PPA, let me now if > I'm not testing it correctly > > El Tue Nov 11 2014 at 11:03:24 a. m., "Peter Löwe" <[email protected]> > escribió: >> >> Dear César, dear all, >> >> thanks for your input, but the core problem remains: >> >> 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". >> >> 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. >> >> Suggestions, anyone ? >> >> Best, >> Peter >> >> >> >> <[email protected]> >> >> >> What I use on scripts is the PNG monitor setting the GRASS_PNGFILE, >> GRASS_HEIGHT and GRASS_WIDTH before starting the monitor. >> >> Take a look at the PNG Driver manual pages for more variables: >> http://grass.osgeo.org/grass64/manuals/pngdriver.html >> >> El lun, 10 de noviembre de 2014 17:42, "Peter Löwe" <[email protected]> >> escribió: >>> >>> Hi all, >>> >>> 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: >>> ERROR: No such monitor as <GRASS_MONITOR> >>> d.out.file output=test20141110 format=geotiff resolution=1 size=1440,720 >>> ERROR: You must select a display monitor. >>> >>> 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. >>> >>> 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. >>> >>> Hints and suggestions would be greatly appreciated. >>> >>> >> >>
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
