[GRASS-user] How to initialize raster maps.

Marcello Gorini gorini at gmail.com
Thu Dec 8 16:26:18 EST 2011


Dear all,

Inside a loop in a shell script, I keep incrementing the values of a raster
map using r.mapcalc with some logical expressions. 

Therefore, I need to initialize the raster map before the loop itself.
Ideally, I would like to initialize it as a raster with the same dimensions
as my base map, but containing only zeros.

In order to do that, I use the following expression:

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

Besides being one of the ugliest pieces of code one could ever write, it
also incurs in waste of processing time.

Which would be a more elegant and optimized way of initializing these raster
maps?

Thanks in advance for any thoughts you could share.

Best regards,
Marcello. 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-initialize-raster-maps-tp7075938p7075938.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list