[GRASS-user] generate a grid with sequential numbers
Moritz Lennert
mlennert at club.worldonline.be
Tue Sep 18 06:11:44 PDT 2012
On 17/09/12 21:32, Markus Neteler wrote:
> Here you go - see screenshot:
>
> # get rows and cols as environment variables
> eval `g.region -g`
> r.mapcalc "grid_seq = col() * $rows + row() + $cols - ($rows + $cols)"
This can be simplified to
r.mapcalc "grid_seq = col() * $rows + row() - $rows"
and gives you a "vertical" sequence.
My solution
r.mapcalc "grid_seq = row() * $cols + col() - $cols"
gives you a "horizontal" sequence.
I added a FAQ at http://grass.osgeo.org/wiki/Sequential_Grid.
Moritz
More information about the grass-user
mailing list