[GRASSLIST:445] Re: Re: grass programming

Ana Soares tiobrothercamarada at gmail.com
Tue Mar 28 08:57:32 EST 2006


Thank you for answering :)

So let me see if I understood : you can only use GRASS 's GIS library and
such in grass environnment, after launching it ($ grass).

There is no way (besides SWIG) that I can use GRASS's structure and
abilities for a specific purpose program without launching GRASS ? I mean,
everytime I want touse GIS library I have t launch GRASS ?

Thanks.

2006/3/28, Markus Neteler <neteler at itc.it>:
>
> To run GRASS *commands* from outside, take a look at the SWIG interface.
> It is only prototype, but looks promising:
>
> http://grass.itc.it/devel/index.php#prog
> -> GRASS SWIG interface <http://mpa.itc.it/markus/grass61progman/swig/>
>
> Markus
>
> Ana Soares wrote:
>
> > Hi :-)
> >
> >
> > It compiles. But this I don't understand : it runs in grass but not in
> > standard shell session
> >
> > GRASS 6.0.1 (spearfish60):~/Estagio/GRASS_Prototipo1 > ./prot1
> > Argv[0] = ./prot1
> > G_program_name => prot1
> > GRASS 6.0.1 (spearfish60):~/Estagio/GRASS_Prototipo1 >
> >
> >
> > this I don't uderstand
> >  So I can't use its GIS library and so on without entering grass ?
> >
> >
> >
> >
> >
> >
> >
> > 2006/3/28, marcos boullón magán <marcosboullon at gmail.com
> > <mailto:marcosboullon at gmail.com>>:
> >
> >     But your code DOES compile (pointing to the gis.h file)...
> >
> >     marcos at venux:~/cvsgrass/devel/tmp$ cat prot1.c
> >     #include <stdio.h>
> >     #include <unistd.h>
> >     #include <stdlib.h>
> >     #include "../../grass6/include/gis.h"
> >     int main(int argc, char **argv) {
> >       printf("Argv[0] = %s\n", argv[0]) ;
> >       G_gisinit("prot1") ;
> >       printf("G_program_name => %s\n", G_program_name()) ;
> >     }
> >
> >     marcos at venux:~/cvsgrass/devel/tmp$ mkdir OBJ.i686-pc-linux-gnu
> >
> >     marcos at venux:~/cvsgrass/devel/tmp$ gcc
> >     -I/home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/include  -g
> -O2
> >     -Wall -Wconversion -Wno-implicit-int       -DPACKAGE=\""grassmods"\"
> >     -I/home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/include -o
> >     OBJ.i686-pc-linux-gnu/prot1.o -c prot1.c
> >     prot1.c: En la función `main':
> >     prot1.c:23: aviso: control reaches end of non-void function
> >
> >     marcos at venux :~/cvsgrass/devel/tmp$ gcc
> >     -L/home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/lib
> >     -Wl,--export-dynamic
> >
> -Wl,-rpath-link,/home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/lib
> >         -DPACKAGE=\""grassmods"\" -o
> >     /home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/bin/prot1
> >     OBJ.i686-pc-linux-gnu/prot1.o  -lgrass_gis -lgrass_datetime -lz
> >     -lgrass_segment -lm  -lz
> >
> >     marcos at venux:~/cvsgrass/devel/tmp$ dir
> >     /home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/bin/prot1
> >     -rwxr-xr-x  1 marcos marcos 32173 2006-03-28 13:26
> >     /home/marcos/cvsgrass/grass6/dist.i686-pc-linux-gnu/bin/prot1
> >
> >
> >     ... and also DOES work under GRASS...
> >
> >     marcos at venux:~/cvsgrass/devel/tmp$ grass61
> >     [...]
> >
> >     GRASS 6.1.cvs (spearfish60):~/cvsgrass/devel/tmp >
> >     ../../grass6/dist.i686-pc-linux-gnu/bin/prot1
> >     Argv[0] = ../../grass6/dist.i686-pc-linux-gnu/bin/prot1
> >     G_program_name => prot1
> >
> >
> >     Just remember, you need a succesfully GRASS install to be able to
> >     compile your own code.
> >
> >     M.
> >
> >     2006/3/28, Ana Soares <tiobrothercamarada at gmail.com
> >     <mailto:tiobrothercamarada at gmail.com>>:
> >     >
> >     > Noooo! :-S
> >     >
> >     >  As I've show in the output....
> >     >
> >     >
> >     > 28 Mar 2006 10:47:19 -0000, Nitin <grasschoper at rediffmail.com
> >     <mailto:grasschoper at rediffmail.com>>:
> >     > >
> >     > >
> >     > >
> >     > >
> >     > >  problem solved?
> >     > >
> >     > >
> >     > >  On Tue, 28 Mar 2006 Ana Soares wrote :
> >     > >
> >     > >  >28 Mar 2006 10:29:53 -0000, No Name
> >     <grasschoper at rediffmail.com <mailto:grasschoper at rediffmail.com>>:
> >     > >  > >
> >     > >  > >
> >     > >  > > check path of "gis.h " in ur makefile and don't forget to
> >     link gis
> >     > >  > > library.
> >     > >
> >     > >  > >
> >     > >  > >
> >     > >  > >
> >     > >  > > On Tue, 28 Mar 2006 Ana Soares wrote :
> >     > >  > > >Hei :-)
> >     > >  > > >
> >     > >  > > >I already did that.
> >     > >  > > >
> >     > >  > > >My problem is how to integrate that in a program of my
> own.
> >     > >  > > >For example,
> >     > >  > > >
> >     > >  > > >#include < stdio.h>
> >     > >  > > >
> >     > >  > > >#include "interface.h"
> >     > >  > > >#include <unistd.h>
> >     > >  > > >#include <stdlib.h>
> >     > >  > > >
> >     > >  > > >#include "gis.h"
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >int main(int argc, char **argv) {
> >     > >  > > >
> >     > >  > > >  printf("Argv[0] = %s\n", argv[0]) ;
> >     > >  > > >
> >     > >  > > >  G_gisinit("prot1") ;
> >     > >  > > >
> >     > >  > > >  printf("G_program_name => %s\n", G_program_name()) ;
> >     > >  > > >
> >     > >  > > >  // if (G_parser(argc, argv))
> >     > >  > > >  //exit (-1);
> >     > >  > > >
> >     > >  > > >  //  ask_interface() ;
> >     > >  > > >
> >     > >  > > >}
> >     > >  > > >
> >     > >  > > >I don 't understant why this doesn't work :-(
> >     > >  > > >
> >     > >  > > >Output :
> >     > >  > > >seabiscuit at ubuntu:~/Estagio/GRASS_Prototipo1$ ./prot1
> >     > >  > > >Argv[0] = ./prot1
> >     > >  > > >
> >     > >  > > >bla
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >seabiscuit at ubuntu:~/Estagio/GRASS_Prototipo1$
> >     > >  > > >
> >     > >  > > >(this stopped because I did Ctr C)
> >     > >  > > >
> >     > >  > > >This is what I'm having trouble understanding ....
> >     > >  > > >Help please :-)
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >
> >     > >  > > >28 Mar 2006 10:08:10 -0000, No Name <
> >     grasschoper at rediffmail.com <mailto:grasschoper at rediffmail.com>>:
> >     > >  > > > >
> >     > >  > > > >
> >     > >  > > > > there a programmers manual available in download
> >     section on official
> >     > >  > > sitye
> >     > >  > > > > of GRASS. Give some time on reading it.
> >     > >  > > > >
> >     > >  > > > > enjoy grass
> >     > >  > > > > nitin
> >     > >  > > > >
> >     > >  > > > > On Tue, 28 Mar 2006 Ana Soares wrote :
> >     > >  > > > >
> >     > >  > > > > >Thanks!
> >     > >  > > > > >
> >     > >  > > > > >That really helped :) But I have a lttle problem : I
> >     can't compile
> >     > >  > > it!
> >     > >  > > > > >Any hints ?
> >     > >  > > > > >
> >     > >  > > > > >Thanks :-)
> >     > >  > > > > >
> >     > >  > > > > >2006/3/27, Massimiliano Cannata
> >     <massimiliano.cannata at supsi.ch
> >     <mailto:massimiliano.cannata at supsi.ch>>:
> >     > >   > > > > > >
> >     > >  > > > > > > Ana Soares wrote:
> >     > >  > > > > > >
> >     > >  > > > > > > > Hello :-)
> >     > >  > > > > > > >
> >     > >  > > > > > > > I'm getting really desperate with grass ...
> >     > >  > > > > > > > I want to use its libraries in my C program,
> >     but I can't seem to
> >     > >  > > > > even
> >     > >  > > > > > > > understand how to use G_gisinit :(
> >     > >  > > > > > > >
> >     > >  > > > > > > > Is there any manual that you recommend to helo
> >     me out?
> >     > >  > > > > > > >
> >     > >  > > > > > > > Help / Rescue would be very much appreciated!!
> >     > >  > > > > > > >
> >     > >  > > > > > > > Thanks :-)
> >     > >  > > > > > >
> >     > >  > > > > > > give a look to r.example and v.exaple files
> >     > >  > > > > > > ( http://grass.itc.it/devel/index.php)
> >     > >  > > > > > > hope it helps...
> >     > >  > > > > > > Max
> >     > >  > > > > > >
> >     > >  > > > > > > --
> >     > >  > > > > > >
> >     > >  > > > > > > Eng. Massimiliano Cannata
> >     > >  > > > > > > Scuola Universitaria Professionale della Svizzera
> >     Italiana
> >     > >  > > > > > > Istituto Scienze della Terra
> >     > >  > > > > > > Via Trevano, c.p. 72
> >     > >  > > > > > > CH-6952 Canobbio-Lugano
> >     > >  > > > > > > Tel: +41 (0)58 666 62 18
> >     > >  > > > > > > Fax +41 (0)58 666 62 09
> >     > >  > > > > > >
> >     > >  > > > > > >
> >     > >  > > > > > >
> >     > >  > > > >
> >     > >  > > > >
> >     > >  > > > >
> >     > >  > > > > <
> >     > >
> >     > >  > >
> >
> http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3
> >     > >  > > >
> >     > >  > >
> >     > >  > >
> >     > >  > >
> >     > >  > >
> >     <
> http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3
> >     <
> http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3
> >
> >     >
> >     > >
> >     > >
> >     > >
> >     > >
> >     > >
> >     >
> >     >
> >
> >     --
> >     -- marcos boullón magán
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20060328/f9cf7849/attachment.html


More information about the grass-user mailing list