[GRASS-user] Extrac values with r.mapcalc

Hello, Dear grass_user. My first forum participation in the grass_user list email.

How to extract values of map raster with r.mapcalc? I need make new map raster based on specific value of other raster.

2011/4/13 Gaspar Reyes Póndigo <gos47@hotmail.com>:

Hello, Dear grass_user. My first forum participation in the grass_user list
email.

Welcome!

How to extract values of map raster with r.mapcalc? I need make new map
raster based on specific value of other raster.

Please take a look at the if() conditions:

http://grass.osgeo.org/grass64/manuals/html64_user/r.mapcalc.html

Therein is also a section EXAMPLES.

Markus

Hi! Gaspar,
you can do it one way as follows.

  1. create a vector of desired area that you would like to extract values for.
  2. use v.to rast for converting it into a raster use value = 1 for that raster
    3)open mapcalc and put input raster as A and new created raster as B
  3. enter formula if(B == 1), A, 0), also name the new raster
  4. the new raster shall have the values from the input raster

I hope I got it right for you.
rgs,
Ambrish Dhaka