[GRASS-user] How to initialize raster maps.

Hamish hamish_b at yahoo.com
Thu Dec 8 19:45:18 EST 2011

Marcello wrote:
> > But there is no way to avoid r.mapcalc, is there?

I doubt you'd get very much faster or more efficient even by
writing your own C module. (it would probably only take you a
minute to create a r.zero module out of the doc/raster/r.example
code; just change "return x;" to "return 0;" and compile.

> r.mapcalc "initialized_map=if(base_map>999999,1,0)"
> r.mapcalc initialized_map=0

tip: to avoid all your scripts breaking when you want to use
grass7, always add a space around the '=' in r.mapcalc.

 r.mapcalc "initialized_map = 0"


More information about the grass-user mailing list