[GRASS-dev] g.region -a results in a (slightly) different resolution

Paulo van Breugel p.vanbreugel at gmail.com
Sat Dec 24 01:40:57 PST 2016


On 23-12-16 16:00, Markus Neteler wrote:
> On Fri, Dec 23, 2016 at 3:54 PM, Paulo van Breugel
> <p.vanbreugel at gmail.com> wrote:
>> Dear devs,
>>
>> As I understand, setting the a flag when defining a region should maintain
>> the original resolution. So when setting different bounds based on a vector
>> layer and with the a flag set, I would expect exactly the same resolution.
> ... I think only, when you also use the res=xxx parameter.
>
> https://grass.osgeo.org/grass72/manuals/g.region.html#notes
> "With the -a flag all four boundaries are adjusted to be even
> multiples of the resolution, aligning the region to the resolution
> supplied by the user. The default is to align the region resolution to
> match the region boundaries. "
>
> Please try along with the res=value.
>
> Markus
Strange, the behaviour I described only happens in one particular map 
set I was working in yesterday.

I have tried out in different map sets now, and there it works as I 
expected, i.e., no need to supply the res=value argument.

|# start region|
|> g.region -g|
|projection=99|
|zone=0|
|n=227830|
|s=220120|
|w=630970|
|e=638360|
|nsres=10|
|ewres=10|
|rows=771|
|cols=739|
|cells=569769|
|
||# setting region based on vector|
|> g.region save=test|
|> g.region vector=test|
|> g.region -g|
|projection=99|
|zone=0|
|n=226729.31747673|
|s=216615.56359876|
|w=630721.30299897|
|e=643766.80455016|
|nsres=10.00371303|
|ewres=9.99655291|
|rows=1011|
|cols=1305|
|cells=1319355|
|
||# resetting region, and then setting based on vector with a flag|
|> g.region region=test|
|> g.region -a vector=test|
|> g.region -g|
|projection=99|
|zone=0|
|n=226730|
|s=216610|
|w=630720|
|e=643770|
|nsres=10|
|ewres=10|
|rows=1012|
|cols=1305|
|cells=1320660|

This is how I always assumed, and would hope, it to work. So depending 
on the intended behaviour, perhaps the note should be changed to:

"By default the region resolution is aligned to match the region boundaries.
With the -a flag all four boundaries are adjusted to be even multiples 
of the
resolution, aligning the region to the resolution supplied by the user
(res=xxx), or, if not supplied, to the current resolution"


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20161224/3b3bc95f/attachment-0001.html>


More information about the grass-dev mailing list