[GRASS5] Swig interface for Grass

Hi,

I have uploaded the SWIG/PERL interface from
Ari Jolma to 6.1-CVS at

swig/perl/

The idea is to make GRASS *modules* accessible from
outside.

I would like to receive assistance for the following
(small) problems:
- the file swig/perl/Makefile.PL contains the path to GRASS source
  code hardcoded
- if GRASS was configured with --with-nls, the glocale.h isn't
  found

Unfortunately I am not familiar with PERL Makefiles, so
please someone may fix this in CVS.

As example the 'r.slope.aspect' module is implemented.
The GRASS libs have to be present in /usr/[local/]lib/ such
as for the GRASS-GDAL-ORG plugin.

Thanks to Ari for his efforts! I hope that this interface
will be extended by GRASS developers...

Markus

PS: see also this thread:
http://grass.itc.it/pipermail/grass5/2005-August/thread.html#19435

Hi,

I have added draft 'doxygen' style documentation of the
new SWIG interface in CVS (swig/index.dox).

For a version in HTML, see here:
http://mpa.itc.it/markus/grass61progman/swig/GRASS_SWIG_interface.html

SWIG may help to use GRASS as GIS backbone in other applications,
be local, be WebGIS.

Markus

Does it indicates that adding python binding to grass
will be more easy? I like it!.
I can try to implement that (I am already using a small
python binding for grass library which includes only
few functions which are needed for me). If you are
already working for the python-binding,
count me for testing.

Grass must cross all boundaries... Languages, Toolkits,
platforms....all

On 11/23/05, Markus Neteler <neteler@itc.it> wrote:

Hi,

I have added draft 'doxygen' style documentation of the
new SWIG interface in CVS (swig/index.dox).

For a version in HTML, see here:
http://mpa.itc.it/markus/grass61progman/swig/GRASS_SWIG_interface.html

SWIG may help to use GRASS as GIS backbone in other applications,
be local, be WebGIS.

Markus

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

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

Sajith VK wrote:

Does it indicates that adding python binding to grass
will be more easy? I like it!.

Yes, I guess so.

I can try to implement that (I am already using a small
python binding for grass library which includes only
few functions which are needed for me). If you are
already working for the python-binding,
count me for testing.

As far as I know nobody is working on it at the moment. So you are welcome!

Grass must cross all boundaries... Languages, Toolkits,
platforms....all

Absolutely!

Markus

On 11/23/05, Markus Neteler <neteler@itc.it> wrote:

Hi,

I have added draft 'doxygen' style documentation of the
new SWIG interface in CVS (swig/index.dox).

For a version in HTML, see here:
http://mpa.itc.it/markus/grass61progman/swig/GRASS_SWIG_interface.html

SWIG may help to use GRASS as GIS backbone in other applications,
be local, be WebGIS.

Markus
   

Hello all,

I was going through the perl-grass interface(swing)
and to do the same for python.

Since I am not good in "make and perl" I find difficulty in
modifying the Makefile needed.

So here I am attaching my "typemaps" for python-grass.
Can someone suggest how to develop the Makefile for this?

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

(attachments)

my_typemaps.i (1.34 KB)
renames.i (21 Bytes)

Hello Sajith,

sorry for the delay.
Unfortunately I don't know much about SWIG. My suggestion
is to study how things are done in GDAL. I can see that there
are all typemaps in
gdal/swig/include/

Maybe we should try the same?

Probably I should launch a "call for help" in the
FreeGIS mailing list to find someone to help?

Markus

On Sun, Dec 25, 2005 at 12:43:32PM +0530, Sajith VK wrote:

Hello all,

I was going through the perl-grass interface(swing)
and to do the same for python.

Since I am not good in "make and perl" I find difficulty in
modifying the Makefile needed.

So here I am attaching my "typemaps" for python-grass.
Can someone suggest how to develop the Makefile for this?

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

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

hallo,
what I have read on wikipedia (http://en.wikipedia.org/wiki/SWIG), SWIG
is released under a BSD type license. Could that not be a problem for
GRASS at least for distribution of both software in one package?

I tryed to compile and use the grass.pm module, without success:

./configure --with-cxx --with-nls --with-freetype --enable-largefile --with-tcltk-includes=/usr/include/tcl8.3 --with-postgres-includes=/usr/include/postgresql/ --with-freetype-includes=/usr/include/freetype2/ --with-fftw --with-nls --with-readline --with-sqlite

cd swig/perl
perl Makefile.PL

MakeMaker (v6.17)
Writing Makefile for R_slope_aspect::r_slope_aspect
Writing Makefile for R_slope_aspect
Writing Makefile for Grass

make
make[1]: Entering directory `/usr/src/gis/grass/grass6/swig/perl/R_slope_aspect'
cd r_slope_aspect && make LIB="" LIBPERL_A="libperl.a" LINKTYPE="dynamic" PREFIX="/usr" OPTIMIZE="-O2" PASTHRU_DEFINE="" PASTHRU_INC=""
make[2]: Entering directory `/usr/src/gis/grass/grass6/swig/perl/R_slope_aspect/r_slope_aspect'
cc -c -I/usr/include -I/usr/src/gis/grass/grass6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl/5.8/CORE" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall -fpic -ggdb -DPACKAGE=\""grassmods"\" r_slope_aspect.c
r_slope_aspect.c:4:23: error: grass/gis.h: No such file or directory
In file included from r_slope_aspect.c:5:
local_proto.h:2: error: syntax error before 'RASTER_MAP_TYPE'
r_slope_aspect.c:6:27: error: grass/glocale.h: No such file or directory
r_slope_aspect.c: In function 'r_slope_aspect':
r_slope_aspect.c:36: error: storage size of 'cats' isn't known
r_slope_aspect.c:49: error: 'DCELL' undeclared (first use in this function)
r_slope_aspect.c:49: error: (Each undeclared identifier is reported only once
r_slope_aspect.c:49: error: for each function it appears in.)
r_slope_aspect.c:49: error: 'elev_cell' undeclared (first use in this function)
r_slope_aspect.c:49: error: 'temp' undeclared (first use in this function)
.....
.....

I suppose, this has something to do with last changes in grass header
files(?)

jachym

On Mon, Jan 02, 2006 at 09:15:44AM +0100, Markus Neteler wrote:

Hello Sajith,

sorry for the delay.
Unfortunately I don't know much about SWIG. My suggestion
is to study how things are done in GDAL. I can see that there
are all typemaps in
gdal/swig/include/

Maybe we should try the same?

Probably I should launch a "call for help" in the
FreeGIS mailing list to find someone to help?

Markus

On Sun, Dec 25, 2005 at 12:43:32PM +0530, Sajith VK wrote:
> Hello all,
>
> I was going through the perl-grass interface(swing)
> and to do the same for python.
>
> Since I am not good in "make and perl" I find difficulty in
> modifying the Makefile needed.
>
> So here I am attaching my "typemaps" for python-grass.
> Can someone suggest how to develop the Makefile for this?
>
>
> --
> Change the rules, or the rules will change you
> ---------Kumaranasan

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
LDF MZLU v Brnì
Zemìdìlská 3
613 00 Brno
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

Jachym,

I have fixed the problem in CVS (the wrong include path was defined).

Markus

Jachym Cepicky wrote:

hallo,
what I have read on wikipedia (http://en.wikipedia.org/wiki/SWIG), SWIG
is released under a BSD type license. Could that not be a problem for
GRASS at least for distribution of both software in one package?

I tryed to compile and use the grass.pm module, without success:

./configure --with-cxx --with-nls --with-freetype --enable-largefile --with-tcltk-includes=/usr/include/tcl8.3 --with-postgres-includes=/uusr/include/postgresql/ --with-freetype-includes=/usr/include/freetype2/ --with-fftw --with-nls --with-readline --with-sqlite

cd swig/perl
perl Makefile.PL

MakeMaker (v6.17)
Writing Makefile for R_slope_aspect::r_slope_aspect
Writing Makefile for R_slope_aspect
Writing Makefile for Grass

make
make[1]: Entering directory `/usr/src/gis/grass/grass6/swig/perl/R_slope_aspect'
cd r_slope_aspect && make LIB="" LIBPERL_A="libperl.a" LINKTYPE="dynamic" PREFIX="/usr" OPTIMIZE="-O2" PASTHRU_DEFINE="" PASTHRU_INC=""
make[2]: Entering directory `/usr/src/gis/grass/grass6/swig/perl/R_slope_aspect/r_slope_aspect'
cc -c -I/usr/include -I/usr/src/gis/grass/grass6/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl/5.8/CORE" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall -fpic -ggdb -DPACKAGE=\""grassmods"\" r_slope_aspect.c
r_slope_aspect.c:4:23: error: grass/gis.h: No such file or directory
In file included from r_slope_aspect.c:5:
local_proto.h:2: error: syntax error before 'RASTER_MAP_TYPE'
r_slope_aspect.c:6:27: error: grass/glocale.h: No such file or directory
r_slope_aspect.c: In function 'r_slope_aspect':
r_slope_aspect.c:36: error: storage size of 'cats' isn't known
r_slope_aspect.c:49: error: 'DCELL' undeclared (first use in this function)
r_slope_aspect.c:49: error: (Each undeclared identifier is reported only once
r_slope_aspect.c:49: error: for each function it appears in.)
r_slope_aspect.c:49: error: 'elev_cell' undeclared (first use in this function)
r_slope_aspect.c:49: error: 'temp' undeclared (first use in this function)
.....
.....

I suppose, this has something to do with last changes in grass header
files(?)

jachym