[GRASS-user] g.region -a: what's it supposed to do?

Ken Mankoff mankoff at gmail.com
Fri Nov 27 04:13:30 PST 2020


Hello,

I just got caught by a surprising g.region behavior. Can someone clarify what the "-a" flag is supposed to do? From the docs, "Align region to resolution (default = align to bounds, works only for 2D resolution)".

I have a defined region on a 1000 m grid. The two are defined together and do "align" as seen by the first set of commands (here "align" means the bounds and the resolution match in both ns and ew directions, and there are no fractional values). In this scenario, why is the application of the "-a" flag shifting the boundaries? What is being aligned to what?

My previous understanding is that if I set e,w,n,s AND rows,cols AND res, and they don't all agree, then res takes precedence if -a is set, and otherwise res is subject to the other six paramaters. Alternatively, if just setting e,w,n,s and res, and the e,w res does not match the n,s res, then setting -a would adjust things. But when everything agrees, why is -a shifting the bounds?

grass -c EPSG:3413 G_tmp

g.region w=-638956 e=856044 s=-3354596 n=-655596 res=1000 -p
eval $(g.region -g)
echo $(( ($n - $s)/1000 ))
echo $(( ($e - $w)/1000 ))

# why does this shift things?
g.region w=-638956 e=856044 s=-3354596 n=-655596 res=1000 -pa


I don't see previous questions about this when searching "g.region resolution align bounds site:lists.osgeo.org/pipermail/grass-user/" on Google.


Thanks,

   -k.


More information about the grass-user mailing list