[GRASS-user] Input data format and read multiple files into Grass 6.4.1

Hamish hamish_b at yahoo.com
Sun Apr 28 21:29:00 PDT 2013


Szilard wrote:
> Hello,It is my very first attempt to use Grass. Or any other
> Gis program for that matter.

welcome :)

> I am trying to read in multiple (hundreds, thousand) LiDAR
> ascii files into Grass. They contain elevation data. 
>
> I think I have managed one, and I can make a map of elevations,
> using File, Import Raster Map, Multiple formats using GDAL.
> The format is as follows:
> ncols         1000
> nrows         1000
> xllcorner     562000.000
> yllcorner     7124000.000
> cellsize      1
> nodata_value  -9999.0

this is in the "Arc ASCII format".

r.in.gdal can read it, but so can the r.in.arc module.

> 108.93 108.92 108.97 108.99 109 109.01
> ...
> ...
> ...
> 1000 lines, 1000 columns, representing 1 sq km with values
> at every 1 m.
>
> Files are called
>
> 572000-7144000_dem_1m.asc
> 572000-7145000_dem_1m.asc
> 572000-7146000_dem_1m.asc
> etc.
> Can this data be loaded as is,

yes

> or it needs to be converted to a format where
> X Y Z are columns 1, 2, 3 etc.. 

it's possible, but a bit of work and not needed.

> My question is, how do Y read in multiple files? I have
> tried concatenating them, no luck.

Are you on Mac or Linux or Windows? (if Windows start grass
with the MSYS command prompt)

here is the command line loop:

for FILE in *.asc ; do
  MAP=`basename $FILE .asc`
  r.in.arc in=$FILE out=$MAP
done

then 'g.region rast=$MAP' to set the computational bounds to
the extent of one map.

you can use 'g.region rast=map1,map2,map3,...' to extend them
to the bounds of all maps listed, but I'm not sure how happy
that will be with 1000s of maps. (I never tried that many)

finally, with the computational bounds set to the extent of
all maps (maybe you know that area already) you can use the
r.patch module to combine them all into a single map.


have fun,
Hamish


More information about the grass-user mailing list