[GRASSLIST:834] Re: UNSOLVABLE problem in GRASS!!?

Paul Kelly paul-grass at stjohnspoint.co.uk
Mon Jul 28 04:19:09 EDT 2003


On Mon, 28 Jul 2003, Massimiliano Cannata wrote:

> If it is, once you have your raster boundary map (suppose with
> value=1 inside and value=0 outside) and your raster slope map you
> should run r.mapcalc so to have NULL outside and slope inside.
> (something like this but check the rigth formalism:
> if
> boudary = 0 final_map=NULL
> else if
> boundary=1 final_map=slope_map)

Using a MASK is the more conventional way:

g.copy rast=boundary,MASK
r.resample input=slope_map output=final_map
g.remove rast=MASK

Any cell that is zero or NULL in the MASK will be masked out during any
subsequent raster operations while the MASK is in force.

I'm not sure if r.mapcalc totally copies all the parts of a raster; maybe
it does now. r.resample is probably the more 'correct' command to use but
as usual there are several ways of doing the same thing.

You can create masks using the r.mask command but I've always found it
easier to create it some other way and then copy it to the raster map
'MASK' using g.copy and g.remove as shown above.




More information about the grass-user mailing list