Opened 12 years ago

Closed 11 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 by martinl, 12 years ago

Do you mean something like

g.region n=n+1000

it's working.

comment:2 by alf, 12 years ago

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

in reply to:  2 ; comment:3 by martinl, 12 years ago

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 by dickeya, 12 years ago

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.

in reply to:  3 comment:5 by alf, 12 years ago

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 by martinl, 12 years ago

Keywords: g.region expand added
Milestone: 6.4.26.4.3

comment:7 by hamish, 11 years ago

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.