[GRASS-user] Extract a smaller image (sample) from a raster map

Nikos Alexandris nik at nikosalexandris.net
Sun Jun 30 13:42:12 PDT 2013


Lbxa wrote:
> Many thanks for the explanation!

(Thanks to the guys spending nights to code all that stuff...)

> I read the links you have posted and others like specific to r.region and
> g.region, still a bit confuse with some concepts. HOWEVER, still not able
> yet to extract a smaller image from the bigger one!. Have used *g.region*
> setting the values of a smaller area, and have set it as computational
> region but the image displayed is the same.
> 
> I did the same importing a new image and setting r.region but not getting
> any difference! Feel a little bit frustrated

(No pain, no Gain :-p).

So, one step at a time, and assuming you have created a Location based on the 
Spatial Reference System in which your data are defined/projected:

1. import raster map(s) using r.in.gdal -- nothing else required (no r.region 
required unless something is "wrong" with the imported data)

2. set the computational region using g.region, e.g.
  - "g.region rast=YourRastMap" will set the computational region to match the 
extent of your raster map (which is _not_ what you are after, if I got it 
right)
  - "g.region w= e= s= n=" to set a custom defined computational region

3. r.mapcalc "Test = YourRasterMap" -- this will simply "copy" YourRasterMap, 
yet, only for inside the computational region!

Hope this helps a bit,

Nikos


More information about the grass-user mailing list