Opened 8 years ago

Closed 7 years ago

#1530 closed enhancement (fixed)

g.region shrink / expand parameter

Reported by: alf Owned by: grass-dev@…
Priority: normal Milestone: 6.4.3
Component: Default Version: 6.4.1
Keywords: g.region, expand Cc:
CPU: Unspecified Platform: Unspecified

Description

Hi,

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

Best,

Alessandro Frigeri

Change History (7)

comment:1 Changed 8 years ago by martinl

Do you mean something like

g.region n=n+1000

it's working.

comment:2 Changed 8 years ago by alf

Resolution: fixed
Status: newclosed

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

comment:3 in reply to:  2 ; Changed 8 years ago by martinl

Replying to 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?

comment:4 Changed 8 years ago 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.

comment:5 in reply to:  3 Changed 8 years ago by alf

Resolution: fixed
Status: closedreopened

Replying to martinl:

Replying to 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

comment:6 Changed 8 years ago by martinl

Keywords: g.region expand added
Milestone: 6.4.26.4.3

comment:7 Changed 7 years ago by hamish

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.