[GRASS-dev] Re: g.region bugs [was: GRASS 6.3.0
release preparation]
Maciej Sieczka
tutey at o2.pl
Tue Oct 16 13:26:07 EDT 2007
Glynn Clements wrote:
> Maciej Sieczka wrote:
>
>>>> hm, I disabled G_aling_window(), seems to work... (in CVS)
>>> Reverted in CVS.
>>>
>>> If the user specifies -a, the region should be aligned.
>> After Glynn reverted Martin's commit, I experience the
>> following:
>>
>> $ g.region n=5680980 s=5680960 w=602440 e=602480 res=20 -ag
>> n=5680980
>> s=5680960
>> w=602440
>> e=602480
>> nsres=20
>> ewres=20
>> rows=1
>> cols=2
>> cells=2
>>
>> $ echo "L 2 571600 5722275
>> 571610 5722275" | v.in.ascii -n out=line form=standard --o
>>
>> $ g.region vect=line res=1 -ag
>> ERROR: Invalid region: North must be larger than South
>
> This is due to this change:
>
> Index: lib/gis/align_window.c
> ===================================================================
> RCS file: /grassrepository/grass6/lib/gis/align_window.c,v
> retrieving revision 2.5
> retrieving revision 2.6
> diff -u -r2.5 -r2.6
> --- lib/gis/align_window.c 13 Apr 2007 22:42:58 -0000 2.5
> +++ lib/gis/align_window.c 15 Oct 2007 11:12:03 -0000 2.6
> @@ -49,9 +49,9 @@
>
> preserve = window->proj == PROJECTION_LL && window->east == (window->west+360);
> window->south =
> - G_row_to_northing (ceil(G_northing_to_row (window->south, ref)), ref);
> + G_row_to_northing (floor(G_northing_to_row (window->south, ref)), ref);
> window->north =
> - G_row_to_northing (floor(G_northing_to_row (window->north, ref)), ref);
> + G_row_to_northing (ceil(G_northing_to_row (window->north, ref)), ref);
> window->east =
> G_col_to_easting (ceil(G_easting_to_col (window->east, ref)), ref);
> window->west =
>
> Originally, it rounded both edges outwards (i.e. north up, south
> down). The change makes it round inwards, so if it's less than a cell
> high, the north and south edges will be the wrong way around.
>
> Reverted in CVS.
Thanks Glynn.
So, we are back to were it all started. More findings and
details follow.
Correction to original report - the bug *does* crop out in
GRASS 6.2.3 CVS too. However, differently. Please see:
The vector line is as follows:
$ echo "L 2 1
602473.66691719 5680962.45268225
602448.70284465 5680961.09147704
1 1" | v.in.ascii -n form=standard out=line
IN GRASS 6.2.3 CVS:
$ g.region n=5680980 s=5680960 w=602440 e=602480 res=20 -a
$ g.region vect=line res=1 -ag
n=5680980
s=5680960
w=602440
e=602480
nsres=1
ewres=1
rows=20
cols=40
Wrong. But let's try again:
$ g.region vect=line res=1 -ag
n=5680963
s=5680961
w=602448
e=602474
nsres=1
ewres=1
rows=2
cols=26
Correct this time! Strange.
IN GRASS 6.3 CVS:
$ g.region n=5680980 s=5680960 w=602440 e=602480 res=20 -a
$ g.region vect=line res=1 -ag
n=5680963
s=5680942
w=602448
e=602489
nsres=1
ewres=1
rows=21
cols=41
cells=861
Wrong, though different than the first try in 6.2.3 CVS (see
above). But let's try again:
$ g.region vect=line res=1 -ag
n=5680963
s=5680960
w=602448
e=602474
nsres=1
ewres=1
rows=3
cols=26
cells=78
Closer, but still wrong. s should be 5680961.
Maciek
More information about the grass-dev
mailing list