[GRASS-dev] Re: [GRASS-user] r.what and d.what.rast

On Mon, 2 Oct 2006 18:13:16 +0200
Javier Álvarez Rodríguez wrote:

Hi all,
My problem is about I'm obtaining different results when using d.what.rast
and r.what.
Using interactively d.what.rast on a map named bas, I obtain these
results:

361421.875(E) 4540953.125(N)
bas in DATOS, quant (854)
bas in DATOS, actual (854.000000)

Then I write x and y coordinates in a file named pp3.txt

361421 4540953 (no matter real or integer coordinates)

and when using r.what
r.what bas@DATOS < pp3.txt
result is 860

I'm not sure of the cause, but in doing some tests of the same data
set, it would appear that r.what is probably reporting incorrectly.

I looked at the code briefly and can't see any obvious errors, but I'm
ccing the developers list to see if anyone has seen this bug before.

T
--
Trevor Wiens
twiens@interbaun.com

The significant problems that we face cannot be solved at the same
level of thinking we were at when we created them.
(Albert Einstein)

Trevor Wiens wrote:

Javier Álvarez Rodríguez wrote:

> Hi all,
> My problem is about I'm obtaining different results when using d.what.rast
> and r.what.
> Using interactively d.what.rast on a map named bas, I obtain these
> results:
>
> 361421.875(E) 4540953.125(N)
> bas in DATOS, quant (854)
> bas in DATOS, actual (854.000000)
>
> Then I write x and y coordinates in a file named pp3.txt
>
> 361421 4540953 (no matter real or integer coordinates)
>
> and when using r.what
> r.what bas@DATOS < pp3.txt
> result is 860

I'm not sure of the cause, but in doing some tests of the same data
set, it would appear that r.what is probably reporting incorrectly.

I looked at the code briefly and can't see any obvious errors, but I'm
ccing the developers list to see if anyone has seen this bug before.

The problem is with d.what.rast when zoomed out:

# spearfish dataset
G63> g.region elevation.10m
G63> d.rast elvation.10m

G63> d.what.rast

Buttons
Left: what's here
Right: quit

595509.1750503(E) 4920363.03822938(N)
elevation.10m in PERMANENT, quant (1432)
elevation.10m in PERMANENT, actual (1432.339600)

G63> r.what in=elevation.10m east_north=595509.1750503,4920363.03822938
595509.1750503|4920363.03822938||1432.65918

1432.339600 != 1432.65918

G63> r.stats -1gn elevation.10m | grep 1432.3396
595515 4920365 1432.3396

G63> r.stats -1gn elevation.10m | grep 1432.65918
595505 4920365 1432.65918

Indeed, reported x coordinate is off by one column.

G63> g.region n=4920450 s=n-100 e=595550 w=e-80
G63> d.redraw

G63> d.rast.num elevation.10m

G63> echo -e "width 2\nsymbol basic/circle 30 595509.1 4920363.0 yellow none" \
  | d.graph -m

G63> d.what.rast -c
595509.81707317(E) 4920363.23170732(N), 549(col) 763(row)
elevation.10m in PERMANENT, quant (1433)
elevation.10m in PERMANENT, actual (1432.659180)

595510.30487805(E) 4920363.23170732(N), 550(col) 763(row)
elevation.10m in PERMANENT, quant (1432)
elevation.10m in PERMANENT, actual (1432.339600)

So it works ok once zoomed in.

G63> r.what in=elevation.10m east_north=595509.81707317,4920364.20731707
595509.81707317|4920364.20731707||1432.65918

G63> r.what in=elevation.10m east_north=595510.06097561,4920364.08536585
595510.06097561|4920364.08536585||1432.3396

#zooming back out:
g.region rast=elevation.10m
d.redraw
echo -e "width 2\nsymbol basic/circle 5 595509.1 4920363.0 yellow none" \
  | d.graph -m
d.what.rast -c

595518.63321799(E) 4920366.76470588(N), 550(col) 763(row)
elevation.10m in PERMANENT, quant (1432)
elevation.10m in PERMANENT, actual (1432.462769)

G63> r.stats -1gn elevation.10m | grep 1432.462769
595515 4920375 1432.462769

now d.what.rast's y is off by one row ...

Hamish

ps - display/d.what.rast/what.c
  if (G_get_c_raster_row (fd[i], buf, row) < 0)

should that be G_get_raster_row(, type) ??

Thanks a lot for your answer Trevor. I'm not a good programmer but i tried
to do something more. I exported the map (2300x2900 rowsxcols) to an ascii
file and tried to read there the correct solution. It seems that the correct
one is that given by r.what. Maybe that this is a silly question but,... Do
"d.what.rast" depend on monitor resolution?. I mean the map was 2300x2900
cells and don't know how it manages to select coordinates and then obtain
the value.

Best regards

On Mon, 2 Oct 2006 18:13:16 +0200
Javier Álvarez Rodríguez wrote:

Hi all,
My problem is about I'm obtaining different results when using d.what.rast
and r.what.
Using interactively d.what.rast on a map named bas, I obtain these
results:

361421.875(E) 4540953.125(N)
bas in DATOS, quant (854)
bas in DATOS, actual (854.000000)

Then I write x and y coordinates in a file named pp3.txt

361421 4540953 (no matter real or integer coordinates)

and when using r.what
r.what bas@DATOS < pp3.txt
result is 860

I'm not sure of the cause, but in doing some tests of the same data
set, it would appear that r.what is probably reporting incorrectly.

I looked at the code briefly and can't see any obvious errors, but I'm
ccing the developers list to see if anyone has seen this bug before.

T
--
Trevor Wiens
twiens@interbaun.com

The significant problems that we face cannot be solved at the same
level of thinking we were at when we created them.
(Albert Einstein)

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

Folks,

please keep in mind that interactive querying of the display *may* involve
resampling (via nearest neighbor) when display size is much smaller than the
actual size. Please see previous posts by Glynn about automatic resampling
associated with the display architecture- especially since the incorrect
values are coming from d.what.rast.

Cheers,

Dylan

On Wednesday 04 October 2006 00:39, Javier Álvarez Rodríguez wrote:

Thanks a lot for your answer Trevor. I'm not a good programmer but i tried
to do something more. I exported the map (2300x2900 rowsxcols) to an ascii
file and tried to read there the correct solution. It seems that the
correct one is that given by r.what. Maybe that this is a silly question
but,... Do "d.what.rast" depend on monitor resolution?. I mean the map was
2300x2900 cells and don't know how it manages to select coordinates and
then obtain the value.

Best regards

On Mon, 2 Oct 2006 18:13:16 +0200

Javier Álvarez Rodríguez wrote:
> Hi all,
> My problem is about I'm obtaining different results when using
> d.what.rast and r.what.
> Using interactively d.what.rast on a map named bas, I obtain these
> results:
>
> 361421.875(E) 4540953.125(N)
> bas in DATOS, quant (854)
> bas in DATOS, actual (854.000000)
>
> Then I write x and y coordinates in a file named pp3.txt
>
> 361421 4540953 (no matter real or integer coordinates)
>
> and when using r.what
> r.what bas@DATOS < pp3.txt
> result is 860

I'm not sure of the cause, but in doing some tests of the same data
set, it would appear that r.what is probably reporting incorrectly.

I looked at the code briefly and can't see any obvious errors, but I'm
ccing the developers list to see if anyone has seen this bug before.

T

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341