[GRASS5] Swig interface for Grass

Ari Jolma ari.jolma at tkk.fi
Wed Aug 31 01:50:12 EDT 2005

Glynn Clements wrote:

>Ari Jolma wrote:
>>Well, I managed to get a Grass error message from a Perl program :)
>>I made a simple Swig interface file into which I added the main() from 
>>r.slope.aspect with a new name:
>Are you running this from within a GRASS session? The GRASS libraries
>require a number of environment variables to be set.
Yes, I know, but that was not the point, sorry it was probably not very 
evident from my post. The point was that Markus was toying with the idea 
of having a scripting (Perl, Python,..) interface to Grass library and 
modules and presented it to me. I had some time and wanted to study Swig 
anyway so I tried it and was able to make a Perl interface to the 
libraries and embed the r.slope.aspect app into it (as a function with 
the name r_slope_aspect). The next step would not be for me to get the 
program actually working (with the env vars) but make it into a standard 
Perl module distribution, which would install the normal way (perl 
Makefile.PL; make; make test; install -- it would require Grass sources 
and swig) so people (with more Grass use experience) could try it and we 
could perhaps get the ball rolling. I *think* I know now how to make 
such a distribution (perhaps it would be Geo-Grass-0.01.tar.gz in CPAN) 
but I need perhaps a day to make it (it would include the libs and some 
apps) -- but I can also give my knowledge/results so far to someone else 
who wants to work on this.

We could also discuss a bit how such Perl interface should work / look 
like. Using Swig makes it easier to port the interface to Python and 
other languages.


More information about the grass-dev mailing list