[GRASS-user] d.out.file / d.save - Shell-script use issues
César Augusto Ramírez Franco
caesarivs at gmail.com
Tue Nov 11 08:29:51 PST 2014
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" <peter.loewe at gmx.de>
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
>
>
>
> <peter.loewe at gmx.de>
>
>
> 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" <peter.loewe at gmx.de>
> 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.
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141111/0f9db229/attachment.html>
More information about the grass-user
mailing list