[GRASS-user] extracting region

Moritz Lennert mlennert at club.worldonline.be
Mon Oct 6 09:24:52 EDT 2008


On 06/10/08 14:57, Alberto Pettazzi wrote:
> Dear All,
> 
> I have a region, A, that contains a sub-region, B. How can I extract 
> region B in order to make a new raster map that includes only region B?

- For approximate extraction: zoom in the map so that only B is visible. 
Set region extents to this zoom level (in the gis.m GUI Map Display 
window, zoom menu, "Set computational region from display"), then 
r.mapcalc "newmap=oldmap"

- For exact extraction:

1) If the subregion B is characterised by one or several distinct pixel 
values (i.e. distinct from the rest of A), something like this:
r.mapcalc "newmap=if(oldmap>MinPixVal && oldmap<MaxPixVal, oldmap, null())"


2) If the subregion B is only a geographic subregion, but its values are 
similar to those in the rest of A, then digitize the boundaries of B as 
an area with v.digit, then v.to.rast output=MASK, then r.mapcalc 
"newmap=oldmap".

Moritz


More information about the grass-user mailing list