> I am working on accessing grass functionalities through python, but I don't
> know which way I should take to achieve this goal.
>
> I have SWIG WIN, GRASS 6.3, Python 2.5, Quantum GIS 0.11
>
> I want to call suppose "mapcalc" of grass from inside python.
>
> Whether this is possible, If yes then how. Whether it can be achieved
> through g.parser, SWIG or through any other way.
I would suggest to use Python scripting library from GRASS >= 6.4 [1].
See raster.mapcalc().
The existing grass.mapcalc() function won't work in 6.4. That function
shouldn't have been backported from 7.0, as it requires the 7.0
version of r.mapcalc (which uses G_parser()).
It needs something like:
- if run_command('r.mapcalc', expression = e) != 0:
+ if write_command('r.mapcalc', stdin = e) != 0:
Either that, or use call(['r.mapcalc', expression]).
The existing grass.mapcalc() function won't work in 6.4. That function
shouldn't have been backported from 7.0, as it requires the 7.0
version of r.mapcalc (which uses G_parser()).
It needs something like:
- if run_command('r.mapcalc', expression = e) != 0:
+ if write_command('r.mapcalc', stdin = e) != 0:
Either that, or use call(['r.mapcalc', expression]).
Thank you very much for your response. But as I am newbie to this block, I am not able to make out anything from your reply.
I suppose I am not able to clearly write the exact problem.
I have GRASS 6.3, Python 2.5 and working on Windows platform.
I need to access grass funtionalities from within my python program.
Now the question is How to do this?
On constant searching internet I found some material using g.parser, SWIG or python libs. But I am not sure how to proceed with this.
Or how to configure these, so that I can use them.
It will be very helpful to me if you can step by step tell me how to go ahead.
Thank you once again.
I am working on accessing grass functionalities through python, but I don’t
know which way I should take to achieve this goal.
I have SWIG WIN, GRASS 6.3, Python 2.5, Quantum GIS 0.11
I want to call suppose “mapcalc” of grass from inside python.
Whether this is possible, If yes then how. Whether it can be achieved
through g.parser, SWIG or through any other way.
I would suggest to use Python scripting library from GRASS >= 6.4 [1].
See raster.mapcalc().
The existing grass.mapcalc() function won’t work in 6.4. That function
shouldn’t have been backported from 7.0, as it requires the 7.0
version of r.mapcalc (which uses G_parser()).
It needs something like:
if run_command(‘r.mapcalc’, expression = e) != 0:
if write_command(‘r.mapcalc’, stdin = e) != 0:
Either that, or use call([‘r.mapcalc’, expression]).
On Tue, Sep 15, 2009 at 7:09 AM, Bishwarup Banerjee
<bishwarup.banerjee@gmail.com> wrote:
Hi Martin and Glynn,
Thank you very much for your response. But as I am newbie to this block, I
am not able to make out anything from your reply.
I suppose I am not able to clearly write the exact problem.
I have GRASS 6.3, Python 2.5 and working on Windows platform.
I need to access grass funtionalities from within my python program.
Now the question is How to do this?
Thank you very much for your valuable information. I have downloaded Grass 6.4 and also gone through the pythonlibs documentation. But how to configure the files now? So that I can access them from the python programs.
Thank you in advance.
With Warm Regards,
Bishwarup
On Tue, Sep 15, 2009 at 11:45 AM, Markus Neteler <neteler@osgeo.org> wrote:
Thank you very much for your response. But as I am newbie to this block, I
am not able to make out anything from your reply.
I suppose I am not able to clearly write the exact problem.
I have GRASS 6.3, Python 2.5 and working on Windows platform.
I need to access grass funtionalities from within my python program.
Now the question is How to do this?
As mentioned by Martin, GRASS 6.3 isn’t really suitable. The
entire Python interface was redone in GRASS 6.4 and later, see