[GRASS-dev] [bug #4598] (grass) g.region from raster wrong when crossin 180 deg

this bug's URL: http://intevation.de/rt/webrt?serial_num=4598
-------------------------------------------------------------------------

Subject: g.region from raster wrong when crossin 180 deg

Platform: Mac OSX
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: CVS 2006_05_27

an example is the best way I can describe this. I have an SRTM tile at S18W180, that is it covers
180W-179W/18S-17S. Due to the cell-center alignment of SRTM, it extends 1.5" outside this area,
so the real region of the tile is:

north: 16:59:58.5S
south: 18:00:01.5S
west: 179:59:58.5E
east: 178:59:58.5W
nsres: 0:00:03
ewres: 0:00:03
rows: 1201
cols: 1201

I want to merge this with the nex tile over, S18W179, so I set the region from the two rasters:

g.region rast=S18W180,S18W179

now the region is wrong:

north: 16:59:58.5S
south: 18:00:01.5S
west: 179:00:01.5W
east: 178:59:58.5W
nsres: 0:00:03
ewres: 0:00:03
rows: 1201
cols: 432001

The west edge should not change (179:59:58.5E), and the east edge should be another degree east
(177:59:58.5W) and the column count should be calculated from that, not spanning the globe
(2401). Based on the above wrong E/W, the column count is still wrong, it should be 1 (but it
displays correctly in a monitor).

g.region rast=S18W180

gives the correct region for the single raster.

g.region rast=S18W180,S18E179

for a regionwith the tile to the west instead, gives the correct region.

Manually setting the region to what it should be also gives the wrong region:

g.region w=179:59:58.5E e=177:59:58.5W -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 16:59:58.5S
south: 18:00:01.5S
west: 179:59:58.5E
east: 177:59:58.5W
nsres: 0:00:03
ewres: 0:00:00.000007
rows: 1201
cols: 1037234401

The extents are right, but the ewres/cols is wrong. Forcing the resolution finally fixes the problem:

g.region w=179:59:58.5E e=177:59:58.5W -p -a res=0:00:03
projection: 3 (Latitude-Longitude)
zone: 0
datum: ** unknown (default: WGS84) **
ellipsoid: wgs84
north: 16:59:57S
south: 18:00:03S
west: 179:59:57E
east: 177:59:57W
nsres: 0:00:03
ewres: 0:00:03
rows: 1202
cols: 2402

But only for manually setting e/w, with rast= it doesn't help.

-------------------------------------------- Managed by Request Tracker