Details Ticket 4071


Comment | Reply | Take | Open


Serial Number 4071
Subject d.what.rast strange values outside of map area
Area grass6
Queue grass
Requestors neteler@itc.it
Owner none
Status resolved
Last User Contact Thu Feb 9 03:09:50 2006 (3 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Thu Feb 9 14:59:55 2006 (3 yr ago)
Created Wed Feb 8 15:47:46 2006 (3 yr ago)

Transaction History Ticket 4071


Wed, Feb 8 2006 15:47:46    Request created by guest  
Subject: d.what.rast strange values outside of map area

Platform: GNU/Linux/x86_64
grass obtained from: CVS
grass binary for platform: Compiled from Sources

Hi,

I discovered an unhelpful behaviour of the GRASS monitor
or d.what.rast resp. This bug persists despite the recent
display driver modifications (which may be unrelated to this).

Test case:

#generate a hemisphere (use in non-LatLong location, e.g. Spearfish):
./testsuite/raster/rhemisphere.sh

#zoom to hemisphere:
g.region hemisphere -p

#generate box of same size:
v.in.region hemisphere_box

# open monitor with different ratio than map:
export GRASS_WIDTH=1000
export GRASS_HEIGHT=500
d.mon x0

# view the map and box
d.rast hemisphere
d.vect hemisphere_box type=boundary

#click into no data pixels at border (outside of map box):
d.what.rast

1267(E) 437(N)
hemisphere in neteler, quant   (1080098213)
hemisphere in neteler, actual  (-3199042392403159334141127237487472760781471376965238957138138332769
142568673864556645968880013387064229402063231226593015070762178538729445017824264192.000000)
1293(E) 253(N)
hemisphere in neteler, quant   (1081451460)
hemisphere in neteler, actual  (-0.000000)

Looks fairly ugly. 

uname -a
Linux bartok 2.6.9-22.0.1.ELsmp #1 SMP Tue Oct 18 18:39:02 EDT 2005 x86_64 x86_64
x86_64 GNU/Linux

Is this related to
 http://www.intevation.de/rt/webrt?serial_num=2986&display=History
?

A fix would be appreciated. I don't know where to look for that.

Markus
Thu, Feb 9 2006 03:09:50    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17386.42085.669289.316366@cerise.gclements.plus.com>
Date Thu, 9 Feb 2006 02:09:41 +0000
To Request Tracker <grass-bugs@intevation.de>
Cc grass5@grass.itc.it
Subject Re: [GRASS5] [bug #4071] (grass) d.what.rast strange values outside of map area
In-Reply-To <20060208144747.0DEF01006CD@lists.intevation.de>
References <20060208144747.0DEF01006CD@lists.intevation.de>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Spam-Status No, hits=-4.8 tagged_above=-999.0 required=3.0 tests=BAYES_00, CLICK_BELOW
X-Spam-Level
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 */

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


Thu, Feb 9 2006 14:59:36    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Thu, 9 Feb 2006 14:59:31 +0100
From Markus Neteler <neteler@itc.it>
To Glynn Clements <glynn@gclements.plus.com>
Cc Request Tracker <grass-bugs@intevation.de>, grass5@grass.itc.it, Jaro Hofierka <hofierka@geomodel.sk>
Subject Re: [GRASS5] [bug #4071] (grass) d.what.rast strange values outside of map area
Message-ID <20060209135931.GU19361@bartok.itc.it>
Mail-Followup-To Glynn Clements <glynn@gclements.plus.com>, Request Tracker <grass-bugs@intevation.de>, grass5@grass.itc.it, Jaro Hofierka <hofierka@geomodel.sk>
References <20060208144747.0DEF01006CD@lists.intevation.de> <17386.42085.669289.316366@cerise.gclements.plus.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <17386.42085.669289.316366@cerise.gclements.plus.com>
User-Agent Mutt/1.4.1i
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-Spam-Status No, hits=-4.8 tagged_above=-999.0 required=3.0 tests=BAYES_00, CLICK_BELOW
X-Spam-Level
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 


Thu, Feb 9 2006 14:59:55    Status changed to resolved by mneteler  
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request