[GRASS5] [bug #4071] (grass) d.what.rast strange values outside of map area

Markus Neteler neteler at itc.it
Thu Feb 9 08:59:31 EST 2006


On Thu, Feb 09, 2006 at 02:09:41AM +0000, Glynn Clements wrote:
> 
> Request Tracker wrote:
> 
> > I discovered an unhelpful behaviour of the GRASS monitor
> > or d.what.rast resp.
> 
> It's d.what.rast.
> 
> > This bug persists despite the recent
> > display driver modifications (which may be unrelated to this).
> 
> They are unrelated.
>  
> > Test case:
> 
> > #click into no data pixels at border (outside of map box):
> > d.what.rast
> 
> d.what.rast makes no attempt to check that the selected cell is
> actually inside the map.
> 
> If you click above or below the map, you should get warnings from
> libgis that the program attempted to read an invalid row, e.g.:
> 
> 	WARNING: [elevation.dem in PERMANENT] - read request for row 148 is outside
> 	         region
> 	elevation.dem in PERMANENT  (Null)ERROR reading cell file
> 
> G_get_c_raster_row() will fill the buffer with zeros (not nulls) if
> you ask for an invalid row. Arguably it should use nulls, although
> this case shouldn't be allowed to happen anyhow.
> 
> If you click to either side of the map, d.what.rast will end up
> reading from outside the buffer.
> 
> > Is this related to
> >  http://www.intevation.de/rt/webrt?serial_num=2986&display=History
> > ?
> 
> No.
> 
> > A fix would be appreciated. I don't know where to look for that.
> 
> display/d.what.rast/what.c
> 
> It needs a check along the lines of:
> 
> 	if (row < 0 || row >= nrows || col < 0 || col >= ncols)
> 		/* outside map */
>

Thanks, I have added a test now. If you click outside of
the map, this message appears:

You are clicking outside the map

Example:

Buttons
 Left:  what's here
 Right: quit

962.7016129(E) 599.7983871(N)
hemisphere in neteler, quant   (161)
hemisphere in neteler, actual  (160.717143)

1192.54032258(E) 636.08870968(N)
You are clicking outside the map

1281.25(E) 672.37903226(N)
You are clicking outside the map

Problem solved. Strangely: it must have been since the
existance of d.what.rast or at least after NULL introduction ?!?

Markus 




More information about the grass-dev mailing list