[GRASS5] r.in.bin update for significant ewres/nsres differences in LatLong

Roger Bivand Roger.Bivand at nhh.no
Mon Oct 18 14:30:32 EDT 2004


On Mon, 18 Oct 2004, Markus Neteler wrote:

> Roger,
> 
> following your suggestion I have added a warning in r.in.bin
> to check if EW and NS differ significantly (indicating that
> probably east= and west= are confused).
> 
> Not sure if I am doing that right, patch below.

Looks good to me, though 1:50 is quite liberal, given that most raster 
grids are not far from square, maybe 1:10? I don't think there is any 
other way round user error in this case given that east-west in lat-long 
is, well, round. Maybe a comment on the man page: add to east and west:

"Eastern limit of geographic region (in projected coordinates must be east 
of the west parameter value, but in geographical coordinates will wrap 
around the globe; user errors can be detected by comparing the ewres and 
nsres values of the imported map layer carefully)"

"Western limit of geographic region (in projected coordinates must be west
of the east parameter value, but in geographical coordinates will wrap    
around the globe; user errors can be detected by comparing the ewres and  
nsres values of the imported map layer carefully)"

and give an example, maybe the output og g.region when the first example 
is run with east and west reversed? This was a bad trap, maybe the man 
page is the best place for advice?

Roger

> 
> Markus
> 
> On Mon, Oct 18, 2004 at 02:35:27PM +0200, grass at intevation.de wrote:
> > Author: markus
> > 
> > Update of /grassrepository/grass/src/raster/r.in.bin
> > In directory doto:/tmp/cvs-serv22175
> > 
> > Modified Files:
> > 	main.c 
> > Log Message:
> > added test for LatLong in case the resolution differs significantly (two ways to go around the globe in E/W direction...)
> > 
> > Index: main.c
> > ===================================================================
> > RCS file: /grassrepository/grass/src/raster/r.in.bin/main.c,v
> > retrieving revision 1.14
> > retrieving revision 1.15
> > diff -u -d -r1.14 -r1.15
> > --- main.c	18 Oct 2004 12:23:14 -0000	1.14
> > +++ main.c	18 Oct 2004 12:35:25 -0000	1.15
> > @@ -455,6 +455,9 @@
> >  	x_s = (short *) x_v;
> >  	x_c = (char *)  x_v;
> >  
> > +	if( cellhd.proj == PROJECTION_LL && cellhd.ew_res/cellhd.ns_res > 50. ) /* TODO: find a reasonable value */
> > +		G_warning("East-West (ewres: %f) and North-South (nwres: %f) resolution differ significantly. Did you assign east= and west= correctly?", cellhd.ew_res, cellhd.ns_res);
> > +
> >  	fprintf(stderr, "Percent Complete: ");
> >  	for (row = 0; row < grass_nrows; row++)
> >  	{
> 
> _______________________________________________
> grass5 mailing list
> grass5 at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass5
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no





More information about the grass-dev mailing list