[GRASSLIST:3567] Re: Help for map layer creation

Eric G. Miller egm2 at jps.net
Tue Apr 23 02:04:00 EDT 2002


On Tue, Apr 23, 2002 at 09:50:21AM +0530, Anil Kumar Bhagat wrote:
> Dear Grass User 
>                I want to  convert the vector into a raster with value 1
> for where I want to keep the image, and value zero where I do not. This 
> I am doing to crop an area from the bigger image . Please help me .

$ g.region vect=myvect
# optionally adjust cell resoultion ...
$ v.to.rast input=myvect output=myrast
$ echo 'mycrop = if(myrast,bigimage)' | r.mapcalc

No need for explicit zeros and ones.  The "mycrop" output will have the
extents of "myvect", and the values of bigimage where "myrast" is not
null.  Make sense?

The related concept of a mask can also be used for similar effect (see
r.mask).

-- 
Eric G. Miller <egm2 at jps.net>



More information about the grass-user mailing list