[GRASS-user] Python scripting and GRASS
sonja.jankowfsky at cemagref.fr
Mon Jan 18 03:31:28 EST 2010
Many thanks for your answers!
Eventually, I successed to execute some Grass commands with a python
script through Eclipse.
However, I only reached to call the standalone winGrass and not the
Osgeos integrated version, as the Osgeos grass do not has a lib
directory in its grass folder.
So, here are some corrections for windows to the wiki:
pydev is now located uder: http://pydev.org/updates/
Pydev is not automatically installed, you have to click on the install button after the download.
Before creating a new project you have to add the python interpreters (click auto config and apply) and configure eclipse and pydev.
In windows the grass libraries can be found under the following directories:
Concerning the script test.py, I think it should be
import grass.script as grass instead of import grass
I didn't success to run the test.py script, but the following one:
import grass.script as grass
env = grass.gisenv()
#list all vectors of the mapset
r = grass.read_command("g.list", type='vect')
#union of two vector maps, data specific
grass.run_command("v.overlay", ainput = 'ocsol_mercier', binput =
'chaudanne_ocsol', output = 'ocsol_general', operator='or')
The environment variables for windows are as follows (depending on the
place of installation):
GISRC C:\Documents and Settings\jankowfsky\.grassrc6
Glynn Clements a écrit :
> Markus Neteler wrote:
>>> Can I use SWIG? Do I have to install it extra, or is there an integrated
>> SWIG is an extra software which generates extra Python bindings.
>> You do not necessarily need it for GRASS-Python programming, it
>> depends on the level of integration you want to achieve between your
>> model and GRASS.
> Also, the current SWIG bindings should be considered "experimental",
> and likely to change.
Cemagref de Lyon
3 bis quai Chauveau CP 220
69336 Lyon Cedex 09
Tel : (+33)4 72 20 86 11
Fax : (+33)4 78 47 78 75
More information about the grass-user