[GRASS-dev] [GRASS GIS] #1530: g.region shrink / expand parameter

#1530: g.region shrink / expand parameter
-------------------------+--------------------------------------------------
Reporter: alf | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Hi,

it would be really nice to have a shrink/expand parameter in g.region for
shrinking/expanding the current region.

Best,

Alessandro Frigeri

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
-------------------------+--------------------------------------------------
Reporter: alf | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Do you mean something like

{{{
g.region n=n+1000
}}}

it's working.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by alf):

  * status: new => closed
  * resolution: => fixed

Comment:

Martin,

Yes, that is basically what I was meaning, it's already there and works,
and the manual describe it just fine!
Maybe in future the shrink and expand parameters can be introduced fro a
quickest working region trimming.

Ciao,

Alessandro

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------

Comment(by martinl):

Replying to [comment:2 alf]:

> Maybe in future the shrink and expand parameters can be introduced fro a
quickest working region trimming.

I agree, I would be able to imagine something like

{{{
# g.region n=n+10 s=s-10 w=w-10 e=e+10
g.region offset=10

# g.region n=n-10 s=s+10 w=w+10 e=e-10
g.region offset=-10
}}}

Make sense?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------

Comment(by dickeya):

To add to this idea, I think it would be very useful to grow/shrink the
region based on number of pixels instead of current projection units.
This would ensure exact alignment when changing a region with non-int
units. I currently do this via python.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: reopened
  Priority: normal | Milestone: 6.4.2
Component: Default | Version: 6.4.1
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by alf):

  * status: closed => reopened
  * resolution: fixed =>

Comment:

Replying to [comment:3 martinl]:
> Replying to [comment:2 alf]:
>
> > Maybe in future the shrink and expand parameters can be introduced fro
a quickest working region trimming.
>
> I agree, I would be able to imagine something like
>
> {{{
> # g.region n=n+10 s=s-10 w=w-10 e=e+10
> g.region offset=10
>
> # g.region n=n-10 s=s+10 w=w+10 e=e-10
> g.region offset=-10
> }}}
>
> Make sense?

Yes Martin! For the parameter name I'd rather go with the term 'expand',
and the following entry in the manual

(...)
expand=value
     Expand (positive offset value) or shrink (negative offset value)
current region
(...)

Alessandro

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: reopened
  Priority: normal | Milestone: 6.4.3
Component: Default | Version: 6.4.1
Resolution: | Keywords: g.region, expand
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * keywords: => g.region, expand
  * milestone: 6.4.2 => 6.4.3

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1530#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1530: g.region shrink / expand parameter
--------------------------+-------------------------------------------------
  Reporter: alf | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 6.4.3
Component: Default | Version: 6.4.1
Resolution: fixed | Keywords: g.region, expand
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by hamish):

  * status: reopened => closed
  * resolution: => fixed

Comment:

g.region.grow module added to grass6 addons in r55843.

http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#g.region.grow

Instead of `rows=rows+2*n cols=cols+2*n` (or `rows=rows-2*n
cols=cols-2*n`) I took the easy way and made use of the g.region -a flag,
which rounds outwards to the nearest whole-cell. Feel free to reopen the
wish if you'd like to see a -c flag added to make the expand= (should it
be called amount= or extent=?) refer to cells not map units.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1530#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>