# [GRASS-user] Problem with g.region in lat-lon projection

Wed Nov 30 05:29:55 EST 2011

```John A Stevenson wrote:
> Hi,
>
> I am trying to set up a grid with a specified resolution using g.region.
>  The information about the grid that came with the data that I want to plot
> is:
>  X grid origin:                0.2812500
>  Y grid origin:                -89.81250
>  X grid size:                         640
>  Y grid size:                         480
>  X grid resolution:            0.5625000
>  Y grid resolution:            0.3750000
>
> I set up the grid with the following command:
>
> GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011 > g.region w=0.2812500
> s=-89.81250 cols=640 rows=480 ewres=0.562500 nsres=0.3750000
>
> I would expect this grid to cover the whole globe (e.g. 640*0.5625=360), but
> instead it just generates a thin strip, and the ewres is too small.
>
> GRASS 6.4.1 (global_ll_wgs84):~/NAME/G2011 > g.region -p
> projection: 3 (Latitude-Longitude)
> zone:       0
> datum:      wgs84
> ellipsoid:  wgs84
> north:      74N
> south:      89:48:45S
> west:       0:16:52.5E
> east:       24E
> nsres:      0:20:28.59375
> ewres:      0:02:13.417969
> rows:       480
> cols:       640
> cells:      307200
>
> Where am I going wrong?

I think GRASS prefers to have all the extents n,s,e,w and either
rows/cols or resolution to calculate a region.

With the information available,
North =  -89.81250 + 480 * 0.375 = 90.1875
Interestingly, the North deviation from 90N and the South deviation
from 90S is 0.1875 = 0.375 / 2, half a cell

East = 0.2812500 + 640 * 0.5625 = 360.28125
Interestingly, the East deviation from 360E and the West deviation
from 0 is 0.28125 = 0.5625 / 2, half a cell

It is therefore possible that the true region extents are n=90 s=-90
w=0 e=360 and that X and Y grid origin refer to the center, not the
corner of the lower left cell.

This should work:
g.region n=90 s=-90 w=0 e=360 rows=480 cols=640 -p
and
r.region map=<my_map> n=90 s=-90 w=0 e=360

Markus M
```