Re: [GRASS-user] r.example
Hi Markus, yes, I started GRASS and selected the location 3763_Portugal, so I guess it means i was in a GRASS session? Anyway, I followed the link you provided and finally managed to put it to work! Yeah! I just type r.example and it runs. I have some more questions about writing in rasters but will create a new thread. Thank you all for your help! Cheers, Pedro. From: neteler.os...@gmail.com [neteler.os...@gmail.com] On Behalf Of Markus Neteler [nete...@osgeo.org] Sent: Thursday, June 13, 2013 6:09 AM To: Pedro Mendonça Cc: GRASS user list Subject: Re: [GRASS-user] r.example On Wed, Jun 12, 2013 at 6:19 PM, Pedro Mendonça pfmendo...@fc.ul.pt wrote: My r.example binary went to another directory after it was compiled. I guess it's ok, but anyway, I started grass and on the shell I wrote this: GRASS 6.4.0+42329 (3763_Portugal):~/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin ./r.example ./r.example: error while loading shared libraries: libgrass_gis.6.4.3RC3.so: cannot open shared object file: No such file or directory Is it ./r.example or r.example ? What am I missing? Since the command does not see the libraries, you appear to run it outside of a GRASS session. You may take a look here how to set the needed environment variables in case you don't want to start a GRASS session explicitely: http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29 Markus ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] changing raster values in r.example
Hi. I'm starting to write a simple program based on r.example. For now the goal is to read a DEM file, change some values, and write out another DEM file with the changed values. The r.example creates the second DEM file but with the default region (how can I change the region?) and does nothing to the values. So, I tried this: // for (row = 100; row 200; row++) { if (G_get_raster_row(infd, inrast, row, data_type) 0) G_fatal_error(_(Unable to read raster map %s row %d), name, row); for (col = 240; col 350; col++) { ((CELL *) outrast)[col] = 2000; } if( G_put_raster_row(outfd, outrast, data_type) 0 ) { G_fatal_error(_(Failed writing raster map %s), result); } } // But it's not writing the changed values. I even tried changing the r.example as little as possible just changing this function: // CELL c_calc(CELL x) { x = x + 2000; return x; } // But still didn't work. Any clues why it's not writing? Thanks ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.example
My r.example binary went to another directory after it was compiled. I guess it's ok, but anyway, I started grass and on the shell I wrote this: GRASS 6.4.0+42329 (3763_Portugal):~/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin ./r.example ./r.example: error while loading shared libraries: libgrass_gis.6.4.3RC3.so: cannot open shared object file: No such file or directory Is it ./r.example or r.example ? What am I missing? [..] But how can I run the program? It gives an error: pedro@PedroHost:~/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin$ ./r.example ./r.example: error while loading shared libraries: libgrass_gis.6.4.3RC3.so: cannot open shared object file: No such file or directory You have to run it through a grass session of course, # create test location wgs84, enter grass70 -c EPSG:4326 /geo/grassdb/testing/wgs84 ... .. . # test GRASS 7.0.svn (wgs84):/geo/osgeo/src/grass_trunk/doc/raster/r.example r.example --help ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.example
Yeah!!! So far, so good. ('make distclean' only works if ./configure has already run) Ok. I guess it compiled, as I see an object file: ... ls OBJ.i686-pc-linux-gnu/ main.o But where is the executable? in $GISBASE/bin/ Thanks, actually it's in: /Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin But how can I run the program? It gives an error: pedro@PedroHost:~/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin$ ./r.example ./r.example: error while loading shared libraries: libgrass_gis.6.4.3RC3.so: cannot open shared object file: No such file or directory ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.example
Yes Hamish, I read that and tryed make into some directories but I keep getting the same g.echo issue. Here's an example of the tools directory: pedro@PedroHost:~/Desktop/grass-6.4.3RC3$ cd tools pedro@PedroHost:~/Desktop/grass-6.4.3RC3/tools$ make make -C timer || echo /home/pedro/Desktop/grass-6.4.3RC3/tools/timer /home/pedro/Desktop/grass-6.4.3RC3/error.log make[1]: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found make[1]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/tools/timer' make[1]: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found Makefile:15: warning: overriding commands for target `clean' ../../include/Make/Rules.make:89: warning: ignoring old commands for target `clean' make[1]: CC@: Command not found make[1]: *** [@GRASS_HOME@/dist.@host@/etc/current_time_s_ms] Error 127 make[1]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/tools/timer' make -C mkftcap || echo /home/pedro/Desktop/grass-6.4.3RC3/tools/mkftcap /home/pedro/Desktop/grass-6.4.3RC3/error.log make[1]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/tools/mkftcap' make[1]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/tools/mkftcap' I guess I'll try and see if there is any g.echo command... Do you have any tips? Thanks From: Hamish [hamis...@yahoo.com] Sent: Wednesday, June 05, 2013 10:32 PM To: grass-user@lists.osgeo.org; Pedro Mendonça Subject: RE: [GRASS-user] r.example Pedro wrote: I'm still having errors trying to build the r.example: ... 3) Then, still in the main directory I wrote make. At the I got this: ... GRASS GIS compilation log - Started compilation: Wed Jun 5 14:31:47 WEST 2013 -- Errors in: /home/pedro/Desktop/grass-6.4.3RC3/tools/timer /home/pedro/Desktop/grass-6.4.3RC3/db/db.login /home/pedro/Desktop/grass-6.4.3RC3/display/d.ask /home/pedro/Desktop/grass-6.4.3RC3/display/d.barscale /home/pedro/Desktop/grass-6.4.3RC3/display/d.colorlist [...many...] /home/pedro/Desktop/grass-6.4.3RC3/vector/v.digit /home/pedro/Desktop/grass-6.4.3RC3/vector/v.label.sa /home/pedro/Desktop/grass-6.4.3RC3/visualization/xganim see below: -- In case of errors please change into the directory with error and run 'make'. If you get multiple errors, you need to deal with them in the order they appear in the error log. If you get an error building a library, you will also get errors from anything which uses the library. -- Finished compilation: Wed Jun 5 14:33:20 WEST 2013 make: *** [default] Error 1 ... Any clues? please deal with the above errors first. they may tell you why. Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.example
Nikos, Hamish, I decided to start all over. Deleted the old directory and Unzipped again the source code. Started with make distclean. Here's what I got: pedro@PedroHost:~/Desktop/grass-6.4.3RC3$ make distclean Makefile:22: include/Make/Platform.make: No such file or directory Makefile:23: include/Make/Grass.make: No such file or directory include/Make/Doxygen.make:2: include/Make/Platform.make: No such file or directory make: *** No rule to make target `include/Make/Platform.make'. Stop. And now? From: Hamish [hamis...@yahoo.com] Sent: Thursday, June 06, 2013 1:48 PM To: grass-user@lists.osgeo.org; Pedro Mendonça Subject: RE: [GRASS-user] r.example Pedro wrote: I read that and tryed make into some directories but I keep getting the same g.echo issue. Here's an example of the tools directory: pedro@PedroHost:~/Desktop/grass-6.4.3RC3$ cd tools pedro@PedroHost:~/Desktop/grass-6.4.3RC3/tools$ make make -C timer || echo /home/pedro/Desktop/grass-6.4.3RC3/tools/timer /home/pedro/Desktop/grass-6.4.3RC3/error.log make[1]: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found ok, it seems your include/Make/Platform.make file was not created properly, and sill retains the @placeholder@ names from Platform.make.in. I don't know why though, try 'make distclean' and ./configure again? Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.example
Ok, I did the ./configure commands make distclean ./configure commands make And voilá: -- Following modules are missing the 'description.html' file in src code: -- GRASS GIS compilation log - Started compilation: Thu Jun 6 14:39:26 WEST 2013 -- Errors in: No errors detected. -- Finished compilation: Thu Jun 6 14:48:40 WEST 2013 Yeah!!! So far, so good. The goal is the r.example, so, I did this: pedro@PedroHost:~/Desktop/grass-6.4.3RC3/doc/raster/r.example$ make test -d OBJ.i686-pc-linux-gnu || mkdir -p OBJ.i686-pc-linux-gnu gcc -I/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/include -ggdb -march=native -Wall -Werror-implicit-function-declaration -DPACKAGE=\grassmods\ -I/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/include -o OBJ.i686-pc-linux-gnu/main.o -c main.c gcc -L/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/lib -Wl,--export-dynamic -Wl,-rpath-link,/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/lib -o /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin/r.example OBJ.i686-pc-linux-gnu/main.o -lgrass_gis.6.4.3RC3 -lgrass_datetime.6.4.3RC3 -lz -lm -lz make htmlcmd make[1]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' make /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html/r.example.html HTMLSRC=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin/r.example make[2]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' if [ /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin/r.example != ] ; then GISRC=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/demolocation/.grassrc64 GISBASE=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu PATH=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin:$PATH LD_LIBRARY_PATH=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin:/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/lib: LC_ALL=C /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/bin/r.example --html-description /dev/null | grep -v '/body\|/html' r.example.tmp.html ; true ; fi ../../../tools/mkhtml.sh r.example ; mkdir -p /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html ; /usr/bin/install -c -m 644 r.example.tmp.html /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html/r.example.html ; for file in *.png *.jpg ; do head -n 1 $file | grep '^#!' /dev/null ; if [ $? -ne 0 ] ; then /usr/bin/install -c -m 644 $file /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html ; fi done 2 /dev/null ; true make[2]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' make[1]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' make mancmd make[1]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' make /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/man/man1/r.example.1 MANSRC=/home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html/r.example.html make[2]: Entering directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' mkdir -p /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/man/man1 GRASS_PERL=/usr/bin/perl VERSION_NUMBER=6.4.3RC3 sh ../../../tools/g.html2man/g.html2man /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html/r.example.html /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/man/man1/r.example.1 1 Converting: /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/docs/html/r.example.html to /home/pedro/Desktop/grass-6.4.3RC3/dist.i686-pc-linux-gnu/man/man1/r.example.1 make[2]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' make[1]: Leaving directory `/home/pedro/Desktop/grass-6.4.3RC3/doc/raster/r.example' I guess it compiled, as I see an object file: pedro@PedroHost:~/Desktop/grass-6.4.3RC3/doc/raster/r.example$ ls COMMENTS description.html main.c Makefile OBJ.i686-pc-linux-gnu r.example.tmp.html pedro@PedroHost:~/Desktop/grass-6.4.3RC3/doc/raster/r.example$ ls OBJ.i686-pc-linux-gnu/ main.o But where is the executable? From: Pedro Mendonça Sent: Thursday, June 06, 2013 2:14 PM To: grass-user@lists.osgeo.org; Hamish Cc: Nikos Alexandris Subject: RE: [GRASS-user] r.example Nikos, Hamish, I decided to start all over. Deleted the old directory and Unzipped again the source code. Started with make distclean. Here's what I got: pedro@PedroHost:~/Desktop/grass-6.4.3RC3$ make distclean Makefile:22: include/Make/Platform.make: No such file or directory Makefile:23: include/Make/Grass.make: No such file or directory include/Make/Doxygen.make:2: include/Make/Platform.make: No such file or directory make: *** No rule to make
Re: [GRASS-user] r.example
/grass-6.4.3RC3/vector/v.reclass /home/pedro/Desktop/grass-6.4.3RC3/vector/v.sample /home/pedro/Desktop/grass-6.4.3RC3/vector/v.segment /home/pedro/Desktop/grass-6.4.3RC3/vector/v.select /home/pedro/Desktop/grass-6.4.3RC3/vector/v.support /home/pedro/Desktop/grass-6.4.3RC3/vector/v.surf.idw /home/pedro/Desktop/grass-6.4.3RC3/vector/v.surf.rst /home/pedro/Desktop/grass-6.4.3RC3/vector/v.transform /home/pedro/Desktop/grass-6.4.3RC3/vector/v.to.3d /home/pedro/Desktop/grass-6.4.3RC3/vector/v.to.db /home/pedro/Desktop/grass-6.4.3RC3/vector/v.to.points /home/pedro/Desktop/grass-6.4.3RC3/vector/v.to.rast /home/pedro/Desktop/grass-6.4.3RC3/vector/v.to.rast3 /home/pedro/Desktop/grass-6.4.3RC3/vector/v.type /home/pedro/Desktop/grass-6.4.3RC3/vector/v.univar /home/pedro/Desktop/grass-6.4.3RC3/vector/v.vect.stats /home/pedro/Desktop/grass-6.4.3RC3/vector/v.what /home/pedro/Desktop/grass-6.4.3RC3/vector/v.what.rast /home/pedro/Desktop/grass-6.4.3RC3/vector/v.vol.rst /home/pedro/Desktop/grass-6.4.3RC3/vector/lidar/v.surf.bspline /home/pedro/Desktop/grass-6.4.3RC3/vector/lidar/v.outlier /home/pedro/Desktop/grass-6.4.3RC3/vector/lidar/v.lidar.correction /home/pedro/Desktop/grass-6.4.3RC3/vector/lidar/v.lidar.edgedetection /home/pedro/Desktop/grass-6.4.3RC3/vector/lidar/v.lidar.growing /home/pedro/Desktop/grass-6.4.3RC3/vector/v.out.ogr /home/pedro/Desktop/grass-6.4.3RC3/vector/v.in.ogr /home/pedro/Desktop/grass-6.4.3RC3/vector/v.external /home/pedro/Desktop/grass-6.4.3RC3/vector/v.digit /home/pedro/Desktop/grass-6.4.3RC3/vector/v.label.sa /home/pedro/Desktop/grass-6.4.3RC3/visualization/xganim -- In case of errors please change into the directory with error and run 'make'. If you get multiple errors, you need to deal with them in the order they appear in the error log. If you get an error building a library, you will also get errors from anything which uses the library. -- Finished compilation: Wed Jun 5 14:33:20 WEST 2013 make: *** [default] Error 1 4) Returning to the r.example sub-directory and running make, I still get this: /bin/sh: CC@: not found make: *** [OBJ.@host@/main.o] Error 127 Any clues? Thanks in advance. Pedro Mendonca From: Hamish [hamis...@yahoo.com] Sent: Friday, May 24, 2013 11:36 AM To: grass-user@lists.osgeo.org; Pedro Mendonça Subject: Re: [GRASS-user] r.example Pedro wrote: I'm on a Debian squeeze machine ... installed GRASS (version 6.4.0~rc6+42329-3) (fwiw that is essentially one or two commits away from 6.4.1) Then, I looked for a simple example for reading a raster file in C and found out about the r.example (although didn't find it in my local installment). yes, it's just an example of the source code. So, I downloaded the GRASS source code version 6.4.3RC3 and unzipped it to a folder placed in my Desktop. good, Now, from a Terminal window, I went to the r.example directory and typed make. Here is the result: you'll have to install the build dependencies and run ./configure first, try as root: apt-get build-dep grass then renice +17 -p $$ CFLAGS=-ggdb -march=native -Wall -Werror-implicit-function-declaration \ ./configure \ --with-tcltk-includes=/usr/include/tcl8.5 --with-cairo \ --with-motif --with-python=/usr/bin/python2.6-config \ --with-readline --with-cxx --with-odbc --with-sqlite \ --with-freetype --with-freetype-includes=/usr/include/freetype2 \ --without-postgres --with-proj-share=/usr/share/proj \ --enable-64bit --with-pthread -with-openmp \ --with-wxwidgets=/usr/lib/wx/config/gtk2-unicode-release-2.8 \ --with-geos \ 21 | tee config_log.txt make -j 5 see also the README in the debian/ dir in the source package and http://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] r.example
Hi! I'm a newbie to GRASS and would like to do some C programming with its modules. I'm having some troubles putting to work just a simple raster example (r.example)! I'm on a Debian squeeze machine and installed Quantum GIS with the GRASS plug-in. Nevertheless I installed GRASS (version 6.4.0~rc6+42329-3) via Synaptic Package Manager because I just want to use GRASS modules. I checked where it was installed and the grass64 is in usr/bin but many functions are in usr/lib/grass64/bin. From a terminal window I can call GRASS just by typing grass. So far so good. Then, I looked for a simple example for reading a raster file in C and found out about the r.example (although didn't find it in my local installment). So, I downloaded the GRASS source code version 6.4.3RC3 and unzipped it to a folder placed in my Desktop. Now, from a Terminal window, I went to the r.example directory and typed make. Here is the result: pedro@PedroHost:~/Desktop/grass-6.4.3RC3/doc/raster/r.example$ make make: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found make: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found mkdir -p @GRASS_HOME@/bin.@host@ mkdir -p @GRASS_HOME@/dist.@host@/include/grass mkdir -p @GRASS_HOME@/dist.@host@/lib mkdir -p @GRASS_HOME@/dist.@host@/bin mkdir -p @GRASS_HOME@/dist.@host@/etc mkdir -p @GRASS_HOME@/dist.@host@/driver mkdir -p @GRASS_HOME@/dist.@host@/driver/db mkdir -p @GRASS_HOME@/dist.@host@/fonts test -d OBJ.@host@ || mkdir -p OBJ.@host@ /bin/sh: CC@: not found make: *** [OBJ.@host@/main.o] Error 127 Am I doing something wrong, do I need to install anything else or configure something? Best Regards, Pedro Mendonca ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user