[GRASS-user] Shell scripting basic issues

Markus Neteler neteler at osgeo.org
Thu Sep 6 01:07:25 PDT 2012


On Mon, Aug 20, 2012 at 11:17 AM, DavidRA <theboss777 at gmail.com> wrote:
> For example: Is there a way to access the matrix of cell values of a raster
> to get those values?

Yes.

> If I were operating GRASS directly, I'd use r.what...
> but here I don't use coordinates, I want to get the cell values by its
> matrix positions.

You can use x() and y() of r.mapcalc:
http://grass.osgeo.org/grass64/manuals/html64_user/r.mapcalc.html
Internal variables:
 row()                  current row of moving window
 col()                  current col of moving window
 x()                    current x-coordinate of moving window
 y()                    current y-coordinate of moving window
 ewres()                current east-west resolution
 nsres()                current north-south resolution
 null()                 NULL value

hope this helps,
Markus


More information about the grass-user mailing list