[GRASS-user] Cliping/cropiing DTM with boundary of City

Is it possible to clip (crop) a rectangular DTM raster with irregular
boundary of city (as vector map), so that I can view only city area
filled with DTM. nothing beyond that.

If this can be done, then which command or option will do this?

Please help me.

--
H.S.Rai

Here are two suggestions:

You can use the ‘-cutline’ option to gdalwarp to clip a raster to a polygon. Have a look at this blogpost for details: http://linfiniti.com/2009/09/clipping-rasters-with-gdal-using-polygons/

Within GRASS, you can rasterize the clip polygon calling in “MASK”:

v.to.rast in=city out=MASK use-val value=1

THen run:

r.mapcalc clipped_DTM=original_DTM

Since r.mapcalc honors the MASK, the new raster should be clipped to the city polygon.

On Fri, Aug 19, 2011 at 11:51 AM, Micha Silver <micha@arava.co.il> wrote:

v.to.rast in=city out=MASK use-val value=1
r.mapcalc clipped_DTM=original_DTM

Thanks very much, I worked.

It has one typo, which made my 1st trial unsuccessful, but quickly I
was was able to find that. So, I am reporting here for the benefit of
other user.

"use-val" in 1st command needed to be replaced by "use=val".

Thanks for quick response.

--
H.S.Rai