# [GRASSLIST:8490] Re: setting region resolution

Andrew Danner adanner at cs.duke.edu
Tue Oct 4 15:07:35 EDT 2005

```Jason,

This is because the number of rows and columns have to be integers.
Grass uses the resolution settings you specify as a guess to compute the
number of row and columns by dividing the window size by the resolution.
It rounds this result to an integer number of rows/columns and then
computes the final resolution by dividing the window size by the number
of rows/columns.

Example:

Suppose my north and south boundaries are 101 and 0 respectively. If I
set nsres to 1,  and query the region settings, I'll see that the nsres
is exactly one and there are 101 rows. But if I set my nsres to 5, five
does not evenly divide 101. I need 101/5=20.2 rows of size five to
cover. GRASS will set the number of rows to be 20 by rounding  and
adjust the nsres to be 101/20=5.05.

If you want your resolution to be exactly 1000, adjust your n/s and e/w
boundaries a bit so that they are divisible by the resolution. In my
example, if I want the resolution to be exactly 5, I would expand my
window slightly so that the northing is 105 instead of 101. This adds at
most one row/column.

-Andy

On Tue, 2005-10-04 at 13:40 -0400, Jason Horn wrote:
> Does anyone know why, when you set the resolution of a region, you end
> up getting a resolution slightly different than what you expected?
> For example, in a lambert projection, if I set the resolution as
> follows:
>
>
> g.region nsres=1000 ewres=1000
>
>
> and then I query the region settings...
>
>
> g.region -p
>
>
> I get this
>
>
> .
> .
> .
> nsres:      999.51820128
> ewres:      1000.27989946
> .
> .
> .
>
>
> Thanks,
>
>
> - Jason
>
>
> Jason Horn
>
> Boston University Department of Biology
>
> 5 Cumington Street  Boston, MA 02215
>
>
> jhorn at bu.edu
>
> office: 617 353 6987
>
> cell: 401 588 2766
>
>
>
>

```