[GRASSLIST:4382] Re: mapcalc or ???
Eric G. Miller
egm2 at jps.net
Mon Aug 26 21:36:55 EDT 2002
On Mon, Aug 26, 2002 at 05:16:10PM +0200, J.c.m. van der Kwast wrote:
> Hi,
>
> I'm wondering on how to solve a problem, which is the following. I have
> a simple (raster)map with one irregular shaped object (lets say field)
> of interest (cat1, everything else=0).
> How to divide this field into strips of one cell wide in the same
> direction, eg north to south or east to west and vice versa, each
> representing a different cat?
> I've been playing around with mapcalc and with the help of the doc's
> I've succeded in growing a border of one cell and even a strip of one
> cell representing the for example the north side of the field. Then
> growing a strip of one cell to the south and give it a new value I can
> manage, but dividing up the whole field is beyond me. Any suggestions?
Perhaps you want the row() function, coupled with isnull()?
output = if (isnull(input), null(), row())
If you want rows to start from 1, afterward, find the mininum
value and then subtract:
output2 = if(isnull(output), null(), output - <constant>)
--
Eric G. Miller <egm2 at jps.net>
More information about the grass-user
mailing list