[GRASS-user] Re: [GMT-HELP] Some ideas on GRASS-GMT integration
Hamish
hamish_nospam at yahoo.com
Mon May 21 09:18:31 EDT 2007
Thomas Adams wrote:
> I wish I knew some Python, as I would like to be able to help. I hope
> to contribute some GRASS modules this year related to some of the
> work I do.
There is a nice 10 minute tutorial for programmers of other languages here:
http://www.poromenos.org/tutorials/python
To use the GRASS SWIG/Python interface to libgis:
(work in progress; you can do most things with modules without this)
$ cd /usr/src/grass63/swig/python
$ make
GRASS> cd /usr/src/grass63/swig/python
GRASS> python
..
>>> import os, sys
>>> import python_grass6 as pyg6
>>> pyg6.G_gisinit('')
>>> mapset=pyg6.G_mapset()
>>> print mapset
user1
>>> print pyg6.G_database_unit_name(1)
meters
>>> print pyg6.G_database_projection_name()
UTM
>>> print pyg6.G_database_datum_name()
nad27
>>> pyg6.G_yes("Does it work?", 1)
Does it work?(y/n) [y] y
1
>>> print pyg6.G_getenv("GRASS_GUI")
text
Hamish
More information about the grass-user
mailing list