[GRASS5] r.mapcalc: Neighborhood cell index

Glynn Clements glynn.clements at virgin.net
Tue Feb 18 08:54:29 EST 2003

Markus Neteler wrote:

> a question related to r.mapcalc's scheme of neighborhood cell index:
> In Larson, Shapiro, Tweddale, 1991, "Performing Map Calculations on GRASS
> Data: r.mapcalc Programa Tutorial", 3.5. Neighborhood modifiers, p.8.
> http://grass.itc.it/gdp/raster/mapcalc.pdf
> is written:
> "format is map[r,c],..."
> "map[1,2] refers to one row below and two columns to the right..."
> That means:
>  map[y,x] with x positive to "East" and y positive to "South".
> For curiousity: Is there a particular reason to have the orientation
> pointing positive to South?

I don't know the original reason[1], but the reason why it's that way
now is because that's the way it's always been, and changing it would
break anything that uses a row modifier.

[1] However, one plausible explanation is that cell grids (matrices,
bitmap images etc) conventionally have their origin in the top-left
corner. E.g. mathematics textbooks show matrices with the (0,0)
element in the top-left corner, most[2] bitmap image formats start
with the top-left pixel. In turn, this probably has something to do
with the fact that western languages are written left-to-right,

[2] Except, for some reason, the Windows' BMP format normally starts
with the bottom-left pixel. Also, TGA supports multiple orientations
(can be "flipped" in the X and/or Y axes).

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list