[GRASS-dev] [grass-code I][314] r.in.xyz: estimated region half unit off

code I item #314, was opened at 2007-02-25 17:59
Status: Open
Priority: 3
Submitted By: Maciej Sieczka (msieczka)
Assigned to: Hamish Bowman (hamish)
Summary: r.in.xyz: estimated region half unit off
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: raster
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD): 070225

Initial Comment:
The region estimated by r.in.xyz -s is half column and half row off. In Spearfish:

$ g.region rast=elevation.dted -ag
n=4927700
s=4913700
w=590000
e=609000
nsres=100
ewres=100
rows=140
cols=190
cells=26600

$ r.out.xyz in=elevation.dted out=points.xyz

$ r.in.xyz -s in=points.xyz out=points_re.xyz
Range: min max
x: 590050.000000 608950.000000
y: 4913750.000000 4927650.000000
z: 1.000000 255.000000

While, according to g.region -g output above, it should be:

x: 590000.000000 609000.000000
y: 4913700.000000 4927700.000000
z: 1.000000 255.000000

Maciek

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=314&group_id=21

grass-codei@wald.intevation.org wrote:

code I item #314, was opened at 2007-02-25 17:59
Status: Open
Priority: 3
Submitted By: Maciej Sieczka (msieczka)
Assigned to: Hamish Bowman (hamish)
Summary: r.in.xyz: estimated region half unit off
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: raster
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD): 070225

Initial Comment:
The region estimated by r.in.xyz -s is half column and half row off.
In Spearfish:

$ g.region rast=elevation.dted -ag
n=4927700
s=4913700
w=590000
e=609000
nsres=100
ewres=100
rows=140
cols=190
cells=26600

$ r.out.xyz in=elevation.dted out=points.xyz

$ r.in.xyz -s in=points.xyz out=points_re.xyz
Range: min max
x: 590050.000000 608950.000000
y: 4913750.000000 4927650.000000
z: 1.000000 255.000000

While, according to g.region -g output above, it should be:

x: 590000.000000 609000.000000
y: 4913700.000000 4927700.000000
z: 1.000000 255.000000

Maciek

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=314&group_id=21

ok, apparently the map's region isn't being adjusted for resolution
size. I'll look into it.

Hamish

> Initial Comment:
> The region estimated by r.in.xyz -s is half column and half row off.
> In Spearfish:
>
> $ g.region rast=elevation.dted -ag
> n=4927700
> s=4913700
> w=590000
> e=609000
> nsres=100
> ewres=100
> rows=140
> cols=190
> cells=26600
>
> $ r.out.xyz in=elevation.dted out=points.xyz
>
> $ r.in.xyz -s in=points.xyz out=points_re.xyz
> Range: min max
> x: 590050.000000 608950.000000
> y: 4913750.000000 4927650.000000
> z: 1.000000 255.000000
>
> While, according to g.region -g output above, it should be:
>
> x: 590000.000000 609000.000000
> y: 4913700.000000 4927700.000000
> z: 1.000000 255.000000

This is not a bug, -s scan extent of points results are correct.

r.out.xyz outputs points at cell centers, which are half a cell inside
of the region boundary (outer edge of cells).

r.in.xyz -s just reports what is in the input points file, it doesn't
try and merge that with the current region settings.

taking the scan extents result and plugging it into g.region -a
(re)creates the original region settings:

g.region w=590050 e=608950 s=4913750 n=4927650 res=100 -a
g.region -p
[...]
north: 4927700
south: 4913700
west: 590000
east: 609000
nsres: 100
[...]

This is the approach the example in the r.in.xyz help page takes
already.

Nothing more to do. Closing bug.

Hamish

Hamish wrote:

This is not a bug, -s scan extent of points results are correct.

r.out.xyz outputs points at cell centers, which are half a cell inside
of the region boundary (outer edge of cells).

r.in.xyz -s just reports what is in the input points file, it doesn't
try and merge that with the current region settings.

<snip>

This is the approach the example in the r.in.xyz help page takes
already.

Nothing more to do. Closing bug.

Hamish,

You are right. I should have thought more of it before submitting. Sorry.

Maciek