[GRASS-user] cutting issue (again): r.mapcalc vs. r.resample

Hello,
I while ago I asked how to cut a small map from a larger one using the
region settings as boundary for the small map:
http://n2.nabble.com/r-mapcalc-changes-color-table-td4072836.html#a4072836

I tried this again:

Approach 1: r.mapcalc
  
  r.mapcalc "cut=if(boundary_raster, large_map,
null())"

Approach 2: r.resample

  r.resample input=large_map output=cut

I notice the that using Approach 2, the areas that was outside the set
region is white. The underlayung rasters are not visible (or only if I
set the opacity of "cut" to a low value).
If I use Approach 1 with r.mapcalc, the areas outside the region are
really NULL() (=transparent) and underlaying larger rasters are visible.
Only that the result "cut" from r.mapcalc has a new colortable.

Am I doing something wrong?
Why is the no such command r.cut?

Thanks in advance for your help,
Timmie

Did you do:
g.copy rast=boundary_raster,MASK
or alternatively:
r.mask input=boundary_raster -o
(-o for overwrite)
?

Tim Michelsen schrieb:

Hello,
I while ago I asked how to cut a small map from a larger one using the
region settings as boundary for the small map:
http://n2.nabble.com/r-mapcalc-changes-color-table-td4072836.html#a4072836

I tried this again:

Approach 1: r.mapcalc
  
  r.mapcalc "cut=if(boundary_raster, large_map,
null())"

Approach 2: r.resample

  r.resample input=large_map output=cut

I notice the that using Approach 2, the areas that was outside the set
region is white. The underlayung rasters are not visible (or only if I
set the opacity of "cut" to a low value).
If I use Approach 1 with r.mapcalc, the areas outside the region are
really NULL() (=transparent) and underlaying larger rasters are visible.
Only that the result "cut" from r.mapcalc has a new colortable.

Am I doing something wrong?
Why is the no such command r.cut?

Thanks in advance for your help,
Timmie

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

And more:
-%<--

...The category values in the new raster output map layer will be the same as those in the original, except that the resolution and extent of the new raster output map layer will match those of the current geographic region settings (see g.region)....

-%<--

Achim

Tim Michelsen schrieb:

Hello,
I while ago I asked how to cut a small map from a larger one using the
region settings as boundary for the small map:
http://n2.nabble.com/r-mapcalc-changes-color-table-td4072836.html#a4072836

I tried this again:

Approach 1: r.mapcalc
  
  r.mapcalc "cut=if(boundary_raster, large_map,
null())"

Approach 2: r.resample

  r.resample input=large_map output=cut

I notice the that using Approach 2, the areas that was outside the set
region is white. The underlayung rasters are not visible (or only if I
set the opacity of "cut" to a low value).
If I use Approach 1 with r.mapcalc, the areas outside the region are
really NULL() (=transparent) and underlaying larger rasters are visible.
Only that the result "cut" from r.mapcalc has a new colortable.

Am I doing something wrong?
Why is the no such command r.cut?

Thanks in advance for your help,
Timmie

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I tried this again:

Approach 1: r.mapcalc
  
  r.mapcalc "cut=if(boundary_raster, large_map,
null())"

Approach 2: r.resample

  r.resample input=large_map output=cut

I notice the that using Approach 2, the areas that was outside the set
region is white. The underlayung rasters are not visible (or only if I
set the opacity of "cut" to a low value).
If I use Approach 1 with r.mapcalc, the areas outside the region are
really NULL() (=transparent) and underlaying larger rasters are visible.
Only that the result "cut" from r.mapcalc has a new colortable.

some illustrations to my problem:
Spearfish: soils cut on top of elevation

r.mapcalc result:
http://img197.yfrog.com/i/cutmapcalc.png/

r.resample result:
http://img197.yfrog.com/i/cutresample.png/

Regards,
Timmie

On Mon, 25 Jan 2010, Tim Michelsen wrote:

I while ago I asked how to cut a small map from a larger one using the
region settings as boundary for the small map:
http://n2.nabble.com/r-mapcalc-changes-color-table-td4072836.html#a4072836

I tried this again:
Approach 1: r.mapcalc
Approach 2: r.resample

Am I doing something wrong?

Tim,

   Looks like it.

   I asked for guidance on doing just what you need to do: cut out the
project area from a larger DEM.

   The approach that worked for me was described by Helmut Kudrnovsky:

   1) zoom to your area of interest of your larger region.

   2) v.in.region e.g. "v.in.region output=testarea", so the extent of your
   area of interest is defined by the vector "testarea"

   3) "g.region vect=testarea", by this the region is set to your area of
   interest for analysis. "This region defines the geographic area in which
   all GRASS displays and raster analyses will be done."

   Works like a charm.

Rich

I while ago I asked how to cut a small map from a larger one using the
region settings as boundary for the small map:
http://n2.nabble.com/r-mapcalc-changes-color-table-td4072836.html#a4072836

I tried this again:

Approach 1: r.mapcalc
  
  r.mapcalc "cut=if(boundary_raster, large_map,
null())"

Approach 2: r.resample

  r.resample input=large_map output=cut

I notice the that using Approach 2, the areas that was outside the set
region is white. The underlayung rasters are not visible (or only if I
set the opacity of "cut" to a low value).
If I use Approach 1 with r.mapcalc, the areas outside the region are
really NULL() (=transparent) and underlaying larger rasters are visible.
Only that the result "cut" from r.mapcalc has a new colortable.

Am I doing something wrong?

I did nothing wrong.

But when performing the resample in the wxGUI I activated the button
"add to layer manager" below in the dialog window.
The resampled map ("cut") is then automatically added to the map BUT
without the overlay option of d.rast!
I changed the settings in the layer manager and ticked the -o option and
everything worked fine!

Such a nitty detail!
Filed a ticket for this:
http://trac.osgeo.org/grass/ticket/892

Thanks for all suggestions!

Rich wrote:

The approach that worked for me was described by
Helmut Kudrnovsky:

1) zoom to your area of interest of your larger
region.

2) v.in.region e.g. "v.in.region output=testarea",
so the extent of your
area of interest is defined by the vector
"testarea"

3) "g.region vect=testarea", by this the
region is set to your area of
interest for analysis. "This region defines the
geographic area in which
all GRASS displays and raster analyses will be
done."

Works like a charm.

the v.in.region and g.region vect= steps are redundant, but
make sure when you zoom you update the computational region,
not just the display one in the GUI (d.zoom + d.mon does this
automatically)

Hamish

On Mon, 25 Jan 2010, Hamish wrote:

the v.in.region and g.region vect= steps are redundant, but make sure when
you zoom you update the computational region, not just the display one in
the GUI (d.zoom + d.mon does this automatically)

Hamish,

   Good to know. Thanks.

   I'm a CLI person so I use the GUI only to start GRASS because I've hated
that crude, mid-1980s ncurses starting interface for years. Otherwise I much
prefer to work in a virtual console at the command line. Much more
comfortable for me. However, I will concede that I've found the LaTeX GUI
front-end, LyX, to be much quicker and more productive than writing LaTeX in
emacs. So I'm not totally averse to using the pointy-thingie when it's
demonstrably more productive. :slight_smile:

Rich

front-end, LyX, to be much quicker and more productive than writing
LaTeX in
emacs. So I'm not totally averse to using the pointy-thingie when it's
demonstrably more productive. :slight_smile:

The same applies to the new GRASS GUI.
It's awesome and once you get acustomated pretty useful.
You may wanna use the CLI only for scripting...