[GRASS-user] How to 'double mask' an area

Moritz Lennert mlennert at club.worldonline.be
Sun May 20 06:59:54 PDT 2018


Le Sun, 20 May 2018 09:22:44 -0400,
Thomas Adams <tea3rd at gmail.com> a écrit :

> Hi all,
> 
> I've calculated RUSLE over a large region. I want to to mask
> individual watershed areas (which I can do, no problem here) but
> then, over a buffered path (so, a strip) crossing the watershed, I
> want to calculate the average RULSE value. This is something like
> double masking an area.
> 
> Any suggestions how to take the second step? Ideally, I would like to
> be able to intersect the watershed boundary with the vector path and
> use the intersected region as the mask, but I can't figure out how to
> get the intersected region between the vector path and the eatershed
> boundary.
> 

You can go either the vector way, or the raster way.

(untested)

Vector:

r.to.vect -tv watershed out=watershed type=area
v.overlay ain=path bin=watershed out=double_mask
r.mask vector=double_mask

Raster:

v.to.rast path out=path use=val
r.mapcalc "doublemask = if(isnull(path) || isnull(watershed), null(),
1)"
r.mask raster=doublemask


Other means exist to replace the r.mapcalc call (e.g. r.cross). Up to
you to test what is easiest/most efficient for you.

Moritz


More information about the grass-user mailing list