[GRASS-user] TO BE POST: Extract a smaller image (sample) from a raster map

COULD THIS BE POSTED TO THE MAILING LIST, PLEASE? I’M SUBSCRIBED TO IT BUT MY POST APPEAR AS "… NOT been accepted by the mailing list yet. "

Hi everyone:

Have Modis images MOD13Q1 reprojected into Tiff format imported into grass to analize NDVI for different months and seasons. As I just need to analize NDVI for a specific crop area of the image imported, I want to extract or select that region from the raster map.

After reading several post explaining that R.region/G.region should be use to set the geographic boundaries, I decided to follow the instruction and have use r.region setting nort, south, east and west values of the smaller area BUT only get the same image narrower in width and longer in high.

Now, when I follow the use of this command again I get the message “unable to parse command r.region”

I’m new in Grass! and feel confuse. What I am missing? Please help! Many Thanks in adavance.

Liria Boix wrote:

Hi everyone:

Hello Liria,

Have Modis images MOD13Q1 reprojected into Tiff format imported
into grass to analize NDVI for different months and seasons. As I just
need to analize NDVI for a specific crop area of the image imported, I want
to extract or select that region from the raster map.

You need to use g.region to set the "computational region", that is the extent
to which (almost) all grass raster modules will operate on.

After reading several post explaining that R.region/G.region
should be use to set the geographic boundaries,

The "r.region" module will define/modify the boundaries of the image itself,
not the extent where the raster operations will take place. This module is
useful, for example, in case the extent or the "placement" of a raster map is
not the one it should be/the user wants it to be.

I decided to follow the
instruction and have use r.region setting nort, south, east and
west values of the smaller area BUT only get the same image narrower in
width and longer in high.

You need to use g.region.

Now, when I follow the use of this command again I get the message "unable
to parse command r.region"

I'm new in Grass! and feel confuse. What I am missing? Please help! Many
Thanks in adavance.

Please have a quick-read through the following useful material:

- <http://grass.osgeo.org/grass64/manuals/rasterintro.html&gt;
- <http://grass.osgeo.org/grass64/manuals/imageryintro.html&gt;

There are several references upon "r.region" and "g.region".

Best, Nikos

Many thanks for the explanation!

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

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Extract-a-smaller-image-sample-from-a-raster-map-tp5063094p5063102.html
Sent from the Grass - Users mailing list archive at Nabble.com.

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

Nikos wrote:

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

just a little side note, at this point in the process it is always
good to check the computational region result with 'g.region -p',
if the bounds and or resolution got messy you can fix it with the
'g.region align=original_map' command, or 'g.region -a res=...' at
the chosen resolution.

also, if you changed anything with r.region it is probably best to
delete the first attempt and re-import the map from the raw file.

Hamish

Many thanks for the step by step explanation and side note!! That was of
great help to me : -)

Now is working! I deleted locations and created a new one making sure I
wasn´t missing anything. Have just used *G.region* and follow the step
outlined here.

-----
Lbxa
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Extract-a-smaller-image-sample-from-a-raster-map-tp5063094p5064450.html
Sent from the Grass - Users mailing list archive at Nabble.com.