C-GRASS combination

Michael Shapiro shapiro at zorro.cecer.army.mil
Mon Dec 7 17:36:20 EST 1992


You may run r.mapcalc with the "equation" as part of the command line:
    r.mapcalc 'x=if(soil==2,10,0)'
Use single quotes (') around the equation to prevent Unix from seeing
things inside the quotes - parenthesis and * are meaningful to Unix shells
unless quoted. You can also use what Unix calls a "what's here" input style:

r.mapcalc << 'EOF'
x=if(soil==2,10,0)
EOF

The quotes around EOF are necessary for the same reasons, although the
set of characters interpreted by Unix in a "what's here" input is reduced.
|
|Is it possible to call GRASS commands such as r.mapcalc from within a UNIX-C
|program?  Is it possible to use UNIX-C statements withing a shell/macro?
|I have noticed that the parameters of the r.mapcalc command (for example - 
|'if(soil==2,10,0)' is the same as a C-statement and wondered if there is any
|way to interface.
|
|thanks, Jim Zollweg, Ag+Bio engineering, Cornell University.
|
|


-----------------------------------------------------------------
Michael Shapiro                        U.S. Army CERL                  
email:   shapiro at amber.cecer.army.mil  Office of GRASS Integration
phone:   (217) 373-7277                P.O. Box 9005                   
fax:     (217) 373-7222                Champaign, Ill. 61826-9005
-----------------------------------------------------------------




More information about the grass-user mailing list