[GRASSLIST:3351] Re: r.mapcalc problem
Hamish
hamish_nospam at yahoo.com
Tue May 4 20:38:47 EDT 2004
> The problem I am experiencing with GRASS is related to simple algebra
> map operations such as '+' and '-'. On page B-13 of the GRASS Seeds
> tutorial, the subsequent step is required:
>
> ~ r.mapcalc 'buffers = mwaybuf + railbuf' <enter>
>
...
> At that time, the 'mwaybuf' raster map contains only a category, with
> number 1, that represents a buffer zone around a motorway. 'railbuf'
> also represents a buffer with category 2, but around railways. In
> those cases, the rest of the maps are 'no data' cells.
...
> but what I obtain is an empty 'buffers' map, where all
> cells are marked 'no data'. What also seems strange is that '-'
> operation on MASK (page B-16 of the same tutorial) results in an
> intersection (a logic AND) between two marked maps.
[here nan means NULL]
1 + nan = nan
1 - nan = nan
1 * nan = nan
1 / nan = nan
if(nan == nan) = nan
etc.
The exception is isnull(nan) = 1
You either need to use r.patch to merge the two maps, or convert the
NULL values to "0" with the 'r.null null=0' command if you want a
cumulative merge. (r.patch will take its value from the first map
listed)
See also r.series
Hamish
More information about the grass-user
mailing list