[GRASS-user] Clipping rasters

Jarek Jasiewicz jarekj at amu.edu.pl
Tue Aug 10 10:58:19 EDT 2010


Hanlie Pretorius pisze:
> Hi,
>
> I thought I created a clipped DEM by rasterising an irregular vector
> boundary and then using a mask to create the clipped DEM from a
> rectangular DEM.
>
> For example:
> -----
> # convert vector border to raster
> v.to.rast input="border" output="border" use="cat" type="area" layer=1
> value=1 rows=4096                                |
>
> # set the mask to the raster border
> r.mask border
>
> # create the clipped DEM
> r.mapcalc
>   
>> dem_clipped=dem_full
>>     
>
> # remove the mask
> r.mask -r
> -----
>
> But it turns out I was wrong, the 'clipped' raster just contains NULL
> values outside of the border raster. What did I do wrong? Is there a
> better way to clip a raster to a vector boundary?
>
> Thanks
> Hanlie
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>   
nothing, everything is OK, if you want change raster size (i.e remove 
areas outside vector) just do

g.region vect=border

v.to.rast input="border" output="border" use="cat" type="area" layer=1
value=1 rows=4096  
etc..
but you will still will have null values outside the the vector, if it has irregular shape
J.




More information about the grass-user mailing list