r.mapcalc.simple(1grass)

πŸ’– r.mapcalc.simple πŸ’–

okay bestie, welcome to r.mapcalc.simple β€” she's from the GRASS User's Manual and she's here to do ONE thing and do it gorgeously: calculate a new raster map from a simple r.mapcalc expression. that's the whole vibe. ✨


🏷️ NAME

r.mapcalc.simple β€” Calculates a new raster map from a simple r.mapcalc expression.

no cap, that's literally her whole job description. πŸ’…


πŸ”‘ KEYWORDS

raster, algebra, simple

keywords stay iconic: raster, algebra, simple. πŸŽ€


πŸ“œ SYNOPSIS

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] [nprocs=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

🚩 Flags

  • -s β€” Generate random seed (result is non-deterministic). so like, she's ✨mysterious✨ now. different every time. do NOT come for her about reproducibility, she warned you. πŸ’€
  • -q β€” Quote the map names. yes queen, wrap those names in quotes. πŸŽ€
  • -c β€” Case sensitive variable names. A and a stop being the same girlie. uppercase and lowercase go their separate ways. πŸ”₯
  • --overwrite β€” Allow output files to overwrite existing files. no hesitation, no mercy. πŸ’…
  • --help β€” Print usage summary. your bestie when you forget the syntax. 🫢
  • --verbose β€” Verbose module output. she will tell you EVERYTHING. πŸ’¬
  • --quiet β€” Quiet module output. she will tell you nothing. shhh. 🀫
  • --ui β€” Force launching GUI dialog. pop-up era. πŸͺŸ

πŸŽ›οΈ Parameters

  • expression=string [required] β€” Formula (e.g. A-B or A*C+B). this is the main character, she goes FIRST. πŸ‘‘
  • a=name β€” Name of input A raster map.
  • b=name β€” Name of input B raster map.
  • c=name β€” Name of input C raster map.
  • d=name β€” Name of input D raster map.
  • e=name β€” Name of input E raster map.
  • f=name β€” Name of input F raster map.
  • output=name [required] β€” Name for output raster map. the glow-up destination. ✨
  • seed=integer β€” Seed for rand() function.
  • nprocs=integer β€” Number of threads for parallel computing
    • 0: use OpenMP default; >0: use nprocs; <0: use MAX-nprocs
    • Default: 0
so <0 means MAX-nprocs, not "negative threads", bestie. use it wisely. ⭐

🌸 DESCRIPTION

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. yeah. the output name is NOT in the formula. she's separate. independent woman. πŸ’…

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.

fr fr: if your expression is getting complicated, go hang out with r.mapcalc instead. this one is the quick-and-cute wrapper. πŸ¦‹

πŸ“ NOTES

the differences vs. the 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().

the differences vs. the 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.

πŸ§ͺ EXAMPLES

Basic examples

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

Example expressions

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

πŸ‘€ SEE ALSO

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


πŸ‘‘ AUTHORS

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

πŸ’Ύ SOURCE CODE

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

Latest change: Thursday Nov 06 16:58:52 2025 in commit: 5bb7b0219668e549efe4d25cadebf58f0d38e957

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

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


k that's the whole thing bestie, you ate. πŸ’–βœ¨ go build some rasters, and remember: GRASS 8.5.0 Reference Manual, last touched Thursday Nov 06 16:58:52 2025 β€” periodt. πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from