GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
r.mapcalc.simple(1) GRASS GIS User's Manual r.mapcalc.simple(1)

r.mapcalc.simple - Calculates a new raster map from a simple r.mapcalc expression.

raster, algebra, simple

r.mapcalc.simple
r.mapcalc.simple --help
r.mapcalc.simple [-sqc] expression=string [a=name] [b=name] [c=name] [d=name] [e=name] [f=name] output=name [seed=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Generate random seed (result is non-deterministic)

Quote the map names

Case sensitive variable names

Allow output files to overwrite existing files

Print usage summary

Verbose module output

Quiet module output

Force launching GUI dialog


Formula (e.g. A-B or A*C+B)

Name of input A raster map

Name of input B raster map

Name of input C raster map

Name of input D raster map

Name of input E raster map

Name of input F raster map

Name for output raster map

Seed for rand() function

r.mapcalc.simple provides a wrapper to r.mapcalc. Up to 6 maps can be combined using simple expressions.

The general syntax for the expression follows r.mapcalc expression format, for example, A + B or exp(A + B) are valid. The variables A, B, ..., F represent raster maps which are provided as options a, b, ..., f.

The result name, i.e. the output raster map, is provided using the option output and, unlike r.mapcalc it is not part of the expression.

This module is meant for convenience (for users and programmers) while the r.mapcalc module is a better choice for more complex expressions and advanced usage.

Differences to r.mapcalc module:

  • The input raster map names and the output map raster name are separate from the expression (formula) which uses generic variable names (A, B, C, ...).
  • The output raster name is not included in the expression.
  • The expression is expected to be a single short one liner without the function eval().
Differences to r.mapcalc.simple module in GRASS GIS 5 and 6:
  • The primary purpose is not being a GUI front end to r.mapcalc, but a wrapper which allows easy building of interfaces to r.mapcalc (including GUIs).
  • Whitespace (most notably spaces) are allowed (in the same way as for r.mapcalc).
  • The variable names are case-insensitive to allow the original uppercase as well as lowercase as in option names (unless the -c flag is used).
  • Option names for each map are just one letter (not amap, etc.).
  • Output option name is output as for other modules (not outfile).
  • Raster map names can be optionally quoted (the -q flag).
  • There is no expert mode (which was just running r.mapcalc).
  • The expression option is first, so it is possible to omit its name in the command line (just like with r.mapcalc).
  • Overwriting of outputs is done in the same way as with other modules, so there is no flag to not overwrite outputs.

r.mapcalc.simple expression="0" output=zeros
r.mapcalc.simple expression="1" output=ones
r.mapcalc.simple expression="2" output=twos

r.mapcalc.simple expression="A + B + C" a=zeros b=ones c=twos output=result1

r.mapcalc.simple expression="(A * B) / 2 + 3 * C" a=zeros b=ones c=twos output=result2

Figure: r.mapcalc.simple graphical user interface

Addition:

A + B

No spaces around operators are not recommended for readability, but allowed in the expression:

A+B

More complex expression with a function:

exp(A+C)+(B-2)*7

r.mapcalc, r3.mapcalc, t.rast.mapcalc, g.region

Vaclav Petras, NCSU GeoForAll Lab
Michael Barton, Arizona State University (updated to GRASS 5.7)
R. Brunzema (original 5.0 Bash version)

Available at: r.mapcalc.simple source code (history)

Latest change: Friday Dec 27 01:53:45 2024 in commit: bd53b2448f13719ddb4f5b4d5cf373f8c259de0b

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual

GRASS 8.4.1

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.