[GRASS-dev] Re: g.region bugs [was: GRASS 6.3.0 release preparation]

Glynn Clements glynn at gclements.plus.com
Tue Oct 16 07:50:51 EDT 2007


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.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list