[GRASS5] Python GRASS swing interface

Sajith VK sajithvk at gmail.com
Sat Mar 11 13:11:41 EST 2006


Hello Ari,

My work is not based on the current Swing appempt at the CVS.
I made it just for my programs and thaught that it may be helpful
for some else too.

I feels that the best approch forward may be by adding support for other
languages in your script. For Python, we need some python specific changes.
See the *.i files in my file.  Please tell me the step forward for implementing
the same.
If you add this count me as the first tester!





On 3/9/06, Ari Jolma <ari.jolma at tkk.fi> wrote:
> Hi Sajith,
>
> It's good to see interest in this topic.
>
> My first impression is that there's a lot of stuff. Are all those header
> files exact copies (probably not) or what's the story? Did you start
> from the current Swig attempt at the CVS? I'd like to hear you describe
> your approach in writing.
>
> I posted some time ago about my 2nd stab at this problem. I did some
> work after that but sent the results only to Markus. Here's that story:
>
> My current approach is based on _one single_ Perl script, which writes
> the swig interface files and builds everything. The perl subdir is not
> needed.
>
> My approach requires some small changes into gisdefs.h, basically to
> comment out the non-existing API which Swig does not like.
>
> I wrote a script (240 lines) which builds Perl modules for grass and all
> raster commands. Adding vector commands is in theory as simple as adding
> one line into this script. Building some command modules surely fails,
> but I've not looked into that. Building of the command modules happens
> in these steps:
>
> 1. make copies of source code and patch the main.c to make them
> functions, not applications
> 2. compile the source code and make an archive file (I use Perl's
> Makefile.PL based system for this)
> 3. create the wrapper code with Swig
> 4. create the dynamic library and the module (again Perl's Makefile.PL
> based system -- the 2nd time!). Also makes and runs test code optionally.
>
> This seems to work for many, if not most, raster commands. This is not
> Perl only since it uses swig but I've not tried this with Python or others.
>
> I think the biggest problem is the text-based i/o of usage, errors etc.
> But that may not be a big problem if one just wants to write scripts.
>
> Also the tight link to Grass database is a problem for me, i.e., to use
> Grass analysis, the data needs first to be imported to Grass.
>
> The three files which are needed for my current approach are in
> map.hut.fi/PerlForGeoinformatics/grass-swig-perl.zip
>
> Right now I don't have time to look into this more, sorry.
>
> I guess followups should be sent just to the grass list.
>
> Ari
>
>
> --
> Prof. Ari Jolma
> Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
> Teknillinen Korkeakoulu / Helsinki University of Technology
> tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
> Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma
>


--
Change the rules, or the rules will change you
     ---------Kumaranasan




More information about the grass-dev mailing list