[GRASS-user] Re: [GMT-HELP] Some ideas on GRASS-GMT integration

Dylan Beaudette dylan.beaudette at gmail.com
Fri May 25 16:39:02 EDT 2007


thanks for the pointers Hamish. I will have to look into this some more. 

Anyone else have some experience with the SWIG/python stuff?

cheers,

dylan

On Monday 21 May 2007 06:18, Hamish wrote:
> 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
>
> _______________________________________________
> grassuser mailing list
> grassuser at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassuser

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list