[GRASSLIST:6384] Re: r.mapcalc growing area
Glynn Clements
glynn at gclements.plus.com
Sat Apr 9 18:19:12 EDT 2005
=?ISO-8859-13?Q?M=E2ris_Narti=F0s?= wrote:
> I have two raster maps map1 and map2. map1 covers whole teritory, but
> map2 contains only one cell. I want to modify map2 in following way:
> if map2 cell not null -> calculate new value from map1 and also
> calculate (and assign) new values to all 8 neighborhood cells (i.e.
> [1,1], [-1,0] etc.)
>
> I cant find way how to assign new values to all neighborhood cells and
> do it only if they are one cell far from map2 cell with value. As
> calculating new values takes aditional checks, I always fail in logic.
> :(
if(!isnull(map2[ 0,-1]),...,\
if(!isnull(map2[ 1,-1]),...,\
if(!isnull(map2[ 1, 0]),...,\
if(!isnull(map2[ 1, 1]),...,\
if(!isnull(map2[ 0, 1]),...,\
if(!isnull(map2[-1, 1]),...,\
if(!isnull(map2[-1, 0]),...,\
if(!isnull(map2[-1,-1]),...,\
map1))))))))
where ... indicates the calculated cell value.
> Some aditional qs:
> 1) can ! be used to reverse things (ie. !isnull(x) to chek if x is not null)?
Yes.
> 2) is any way to get some feedback from r.mapcalc was any cell
> affected by last command/action?
No.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list