More

R.in.xyz doesn't work in GRASS

R.in.xyz doesn't work in GRASS


I have these LIDAR data *.xyz files (1st col x, 2nd col y, 3rd col z)

485000.16 6508997.48 1.84 485001.27 6508998.92 1.86 485001.02 6508996.68 1.85 485000.77 6508994.45 1.79 485000.52 6508992.19 1.79 485000.02 6508987.69 1.74 485000.23 6508974.93 1.89 485001.02 6508981.87 1.86 485001.54 6508986.50 1.72 485002.32 6508993.34 1.72

… and I want to import them to GRASS GIS. I've tried with one file but r.in.xyz doesn't seem to work. All the program says is that:

r.in.xyz input=C:UsersSiimSkyDriveDokumendidkoolmagistritoolidarandmedfiltreeritud508485.xyz output=508485 fs= Reading data… Writing to map… r.in.xyz complete. 0 points found in region. (Mon Feb 09 20:17:26 2015) Command finished (1 sec)

Looks to me like you have the x and y mixed up. Your region's north is 485999 but the maximum y in the input file is 6508999. Try setting the region as:

g.region -p n=6509000 s=6508000 e=486000 w=485000 res=2

Then do your r.in.xyz command.


As the result is a raster, you need to fix the region before importing the points. Unfortunately, r.in.xyz does not allow you to do that directly (as other commands).

Whith your 10 points in the GRASS shell (or in the Command console):

r.in.xyz input=test.xyz output=testxyz x=1 y=2 z=3 fs="Reading data… 100% Writing to map… 100% r.in.xyz complete. 0 points found in region.

The message specifies that no point has been found in the current region.

Many solutions are proposed in GRASS wiki: import XYZ:

For example, a solution with the s flag:

r.in.xyz -s input=test.xyz output=test2xyz x=1 y=2 z=3 fs="Range: min max x: 85000.160000 485002.320000 y: 6508974.930000 6508998.920000 z: 1.720000 1.890000

Fix a new region with these parameters

g.region n=6508998.920000 s=6508974.930000 e=485002.320000 w=85000.160000 res=2

And import the file:

r.in.xyz input=test.xyz output=test2xyz x=1 y=2 z=3 fs="Reading data… 100% Writing to map… 100% r.in.xyz complete. 9 points found in region.

New

Your region is not correct, you have interchanged the x (west, east) and y (south-north) in the definition of the region.

If the result ofr.in.xyz -sis :

x: 484999.980000 485999.980000 -> w and e y: 6507999.880000 6508999.860000 -> s and n z: 0.230000 6.160000

You fix the region with:

g.region n=6508999.860000 s=6507999.880000 e=485999.980000 w=484999.980000 res=2

and the result is

g.region -p projection: 99 (Lambert Conformal Conic)… north: 6508999.86 south: 6507999.88 west: 484999.98 east: 485999.98…

And not:

north: 485999.98 south: 484999.98 west: 6507999.88 east: 6508999.86

As in you case