[GRASS-user] [d.*] command not executing from standalone script

Ang Sherpa angsherpa232 at gmail.com
Wed Jan 4 22:43:31 PST 2017


Thanks Martin for your response. Actually, cairo is good idea, however,
what I am trying to do is building an app. I have already invested lots of
my time developing interactive gui as shown in the attached screenshot. My
ultimate plan with grass gis is mentioned in the red-box in attached
screenshot.

I have a feeling that this process should work as expected.
1. Isn't there any way to make grass gis run in background or some kind of
temporary directory?
2. Is there any way that can run the GRASS GIS COMMAND SHELL without
running the wxgui?
2. Interestingly in d.mon document it says that  "The desired monitor
should be started once and need not be restarted unless it is stopped for
some reason. A monitor may continue to run for any length of time, even
when no GRASS session is being run." But don't know what these exactly
means if working through standalone script.

I will be really grateful if you could show me some way to make this work.
Will be looking forward to hearing from you.



*Regards,*
*Ang Dawa Sherpa*
*GIS technician - Irrigation Master Plan*
*WRPPF - DOI, Nepal Government*
*Lalitpur*
*contact: 984 007 3861*

On Wed, Jan 4, 2017 at 5:02 PM, Martin Landa <landa.martin at gmail.com> wrote:

> Hi,
>
> 2017-01-04 11:59 GMT+01:00 Ang Sherpa <angsherpa232 at gmail.com>:
> > My script work from "Launch Script" command within Grass Gis environment.
> > However, as a standalone script it just executes nothing not even error.
> So,
> > sleep.time(2) is also not working as expected. Am I missing something?
> > I have attached the script that I used herewith this mail.
> >
> > Will be looking forward to hearing from you.
>
> interactive monitors require running GRASS. It is probably reason why
> wx monitor is not even launched since your script already terminates
> (and GRASS session too). It has no reason to use interactive monitors
> outside of GRASS. If you modify your script like:
>
> gscript.run_command('d.mon', stop='wx6') # we asssume that there is
> already monitors hanging from last run
> gscript.run_command('d.mon',start='wx6',resolution='1')
> time.sleep(2)
> gscript.run_command('d.rast',map='elevation')
> time.sleep(200)
> os.remove(rcfile)
>
> Then monitor shows and will running 200sec. But it has no sense. So I
> suggest you to use:
>
> 1) file-based monitors (which is natural for script, generate
> something, render to file and close)
>
> script.run_command('d.mon',start='cairo',resolution='1',
> output="/path/image.png")
> # no need to sleep
> gscript.run_command('d.rast',map='elevation')
> gscript.run_command('d.mon', stop='cairo')
>
> or
>
> 2) launch your script from running GRASS
>
> Ma
>
> --
> Martin Landa
> http://geo.fsv.cvut.cz/gwiki/Landa
> http://gismentors.cz/mentors/landa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170105/4a34beae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot.jpg
Type: image/jpeg
Size: 422851 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170105/4a34beae/attachment-0001.jpg>


More information about the grass-user mailing list