[GRASS-dev] suggestion for g.region -a

Currently, if you use the -a flag with g.region it will align the region exactly to match the resolution of a map (e.g. g.region -a rast=myrast will set the region to exactly the resolution of myrast regardless of the extents) or the resolution specified in the res or ewres/nwres fields (e.g. g.region -a n=523 s=15 res=10 will adjust the extents a little to make sure the resolution is exactly 10).

However, -a is ignored if the map argument (rast=) or resolution arguments are blank. This means that if you want to change the extents and keep your current resolution, you need to specify the -a flag AND explicitly specify the resolution. Otherwise, the resolution will be adjusted slightly.

Could this be modified so that when the -a flag is used and resolution is NOT specified and a map is NOT specified (i.e., only changing extents) it aligns to the current resolution? That is, respect the -a flag when res/ewres/nsres= is blank and rast= is blank.

Michael


C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

Michael Barton wrote:

Currently, if you use the -a flag with g.region it will align the
region exactly to match the resolution of a map (e.g. g.region -a
rast=myrast will set the region to exactly the resolution of myrast
regardless of the extents) or the resolution specified in the res or
ewres/nwres fields (e.g. g.region -a n=523 s=15 res=10 will adjust
the extents a little to make sure the resolution is exactly 10).

However, -a is ignored if the map argument (rast=) or resolution
arguments are blank.

Actually, you need either vect= or res= (or nsres= or ewres=). rast=
doesn't have any effect. Also, the interpretation is different for
vect= compared to the resolution options.

This means that if you want to change the
extents and keep your current resolution, you need to specify the -a
flag AND explicitly specify the resolution. Otherwise, the resolution
will be adjusted slightly.

Could this be modified so that when the -a flag is used and
resolution is NOT specified and a map is NOT specified (i.e., only
changing extents) it aligns to the current resolution? That is,
respect the -a flag when res/ewres/nsres= is blank and rast= is blank.

It would be possible to implement the -a flag unconditionally,
although you would need to exclude the cases which already have a
defined meaning (e.g. "g.region -a nsres=..." only aligns the top and
bottom edges, leaving the left and right edges unchanged).

--
Glynn Clements <glynn@gclements.plus.com>

On Jan 27, 2008, at 11:08 PM, Glynn Clements wrote:

Michael Barton wrote:

Currently, if you use the -a flag with g.region it will align the
region exactly to match the resolution of a map (e.g. g.region -a
rast=myrast will set the region to exactly the resolution of myrast
regardless of the extents) or the resolution specified in the res or
ewres/nwres fields (e.g. g.region -a n=523 s=15 res=10 will adjust
the extents a little to make sure the resolution is exactly 10).

However, -a is ignored if the map argument (rast=) or resolution
arguments are blank.

Actually, you need either vect= or res= (or nsres= or ewres=). rast=
doesn't have any effect. Also, the interpretation is different for
vect= compared to the resolution options.

This means that if you want to change the
extents and keep your current resolution, you need to specify the -a
flag AND explicitly specify the resolution. Otherwise, the resolution
will be adjusted slightly.

Could this be modified so that when the -a flag is used and
resolution is NOT specified and a map is NOT specified (i.e., only
changing extents) it aligns to the current resolution? That is,
respect the -a flag when res/ewres/nsres= is blank and rast= is blank.

It would be possible to implement the -a flag unconditionally,
although you would need to exclude the cases which already have a
defined meaning (e.g. "g.region -a nsres=..." only aligns the top and
bottom edges, leaving the left and right edges unchanged).

Yes. That sounds like a good idea.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

--
Glynn Clements <glynn@gclements.plus.com>