[GRASSLIST:7171] Re: crop of raster - once again

Ian MacMillan ian_macmillan at umail.ucsb.edu
Wed Jun 15 13:45:03 EDT 2005


Axel, you might try
r.mapcalc MASK='if(V_rast=0, null(), 1)'

I am not sure if this will work, but it is worth a try.

G'luck,
-Ian

On Jun 15, 2005, at 6:57 AM, Axel Orth wrote:

> Hey,
> I had some success with cropping my raster maps with borders of 
> municipalities (available as vector - converted to raster) and thought 
> I figured out how it works.
>
> But now I try do do the same with some other data and strange things 
> happen:
>
> import raster map "MAP" - import vector "V" - do raster conversation 
> with vector and get the raster map "V_rast"
> set the region: g.region rast=V_rast zoom=V_rast
> create the mask: g.copy V_rast,MASK
> create new map based on the existing map while only the area of the 
> mask is taken into consideration: r.mapcalc MAP_crop=MAP
>
> Problem: the resulting map MAP_crop is just a colored rectangle - the 
> size of the rectangle is equal to the bounding box of V_rast
>
> By chance I made some errors and somehow got the result i wanted:
> instead of the r.mapcalc command shown above I did:
>
> r.mapcalc
> MAP_crop=MAP end -> syntax error
> r.mapcalc MAP_crop=MAP
>
> MAP looks now exactly the way I wanted. When I leave GRASS, start 
> again then MAP looks like I had when imported it.
>
> I have no clue what's this is all about and hope someone has a idea.
>
>
> Regards
> Axel
>




More information about the grass-user mailing list