[GRASS-dev] help

Vaclav Petras wenzeslaus at gmail.com
Tue Mar 18 07:22:36 PDT 2014


Hi,

the scripting interface is appropriate for beginners. You can script in
Python or in Bash (or other shell). You can also start with Graphical
Modeler and then export the model as a script and improve that script.

Here is a page about how to call GRASS modules from Python, especially note
the section Usage Examples:

http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library

You have to run your script from GRASS, i.e. on MS Windows, you go to main
menu File -> Launch Script and perhaps agree to some dialogs, or you can
use Python shell in GRASS GUI call your script using execfile; or just
command line is enough.

The commands (calls of GRASS modules) are usually written in manual and in
tutorials for command line (including the Command console in GRASS GUI) and
looks like this:


r.profile -g input=mymap output=newfile
profile=12244.256,-295112.597,12128.012,-295293.77


And this could be rewritten to Python like this:


grass.run_command('r.profile',
               input = input_map,
               output = output_file,
               profile = [12244.256,-295112.597,12128.012,-295293.77]


This applies to any GRASS module.

There is one new Python interface for GRASS which is more advanced, so if
you would like to use the latest (future) GRASS 7 (not current GRASS
6.4.3), you can try this:

http://grasswiki.osgeo.org/wiki/Python/pygrass

All the best in your studies,
Vaclav



On Mon, Mar 17, 2014 at 10:02 PM, 杨泽龙 <yangzelong at whu.edu.cn> wrote:

> Dear Developers,
>      I'm a student majoring in GIS. Now, I feel interested in the open
> source GIS. I want to know whether there are secondary development
> interfaces for newers to easily develop their desired function?
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140318/05807e16/attachment.html>


More information about the grass-dev mailing list