Hi Martin and Glynn,<br><br>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.<br>I suppose I am not able to clearly write the exact problem.<br><br>
I have GRASS 6.3, Python 2.5 and working on Windows platform.<br><br>I need to access grass funtionalities from within my python program.<br>Now the question is How to do this?<br><br>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.<br>
Or how to configure these, so that I can use them.<br><br>It will be very helpful to me if you can step by step tell me how to go ahead.<br>Thank you once again.<br><br>With Regards,<br>Bishwarup<br><br><br><br><br><div class="gmail_quote">
On Mon, Sep 14, 2009 at 8:38 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
Martin Landa wrote:<br>
<br>
> > I am working on accessing grass functionalities through python, but I don't<br>
> > know which way I should take to achieve this goal.<br>
> ><br>
> > I have SWIG WIN, GRASS 6.3, Python 2.5, Quantum GIS 0.11<br>
> ><br>
> > I want to call suppose "mapcalc" of grass from inside python.<br>
> ><br>
> > Whether this is possible, If yes then how. Whether it can be achieved<br>
> > through g.parser, SWIG or through any other way.<br>
><br>
> I would suggest to use Python scripting library from GRASS >= 6.4 [1].<br>
> See raster.mapcalc().<br>
<br>
</div>The existing grass.mapcalc() function won't work in 6.4. That function<br>
shouldn't have been backported from 7.0, as it requires the 7.0<br>
version of r.mapcalc (which uses G_parser()).<br>
<br>
It needs something like:<br>
<br>
- if run_command('r.mapcalc', expression = e) != 0:<br>
+ if write_command('r.mapcalc', stdin = e) != 0:<br>
<br>
Either that, or use call(['r.mapcalc', expression]).<br>
<font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></blockquote></div><br>