[GRASS-user] Input data format and read multiple files into Grass 6.4.1
R.S. Bhalla
rsbhalla at gmail.com
Sun Apr 28 20:34:48 PDT 2013
Hi Szilard,
This is for the last bit of your question, not sure if I understand the
earlier part of what you were asking.
I've been using a loop written in R (spgrass6) for pulling in multiple
files, I'm sure you can write an equivalent loop in pygrass. Example for
vector import below, you should be able to do something similar for
LiDAR files. Hope this helps.
Cheers,
Ravi
## Start R from within the GRASS console (I simply launch rstudio so I
have a nice environment to work in)
## Load the required libraries
library(spgrass6)
## Specify the directory where your data sits
datadir<-"/xyz/xyz/xyz/Data/"
## List out the maps you want
vectlist<-c("map1", "map2", "map3",.....)
## Note that GRASS automatically assigns the input file name to the output.
## Also note that the overwrite flag, you are creating a new grass dataset
## For rasters you'll want to set the region and resolution using
g.region first.
i<-1
while(i<=length(vectlist)){
execGRASS("v.in.ogr",
flags=c("o", "e", "overwrite"),
parameters=list(
dsn=datadir,
layer=vectlist[i])
)
i <- i+1;
}
On 04/29/2013 07:00 AM, Szilard Albert wrote:
> Hello,
> It is my very first attempt to use Grass. Or any other Gis program for
> that matter.
> 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
> 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, or it needs to be converted to a format
> where
> X Y Z are columns 1, 2, 3 etc..
>
> My question is, how do Y read in multiple files? I have tried
> concatenating them, no luck.
>
> Thank you for your help..
> regards,
> Szilard
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
--
R.S. Bhalla, Ph.D.
Research Associate
Foundation for Ecological Research, Advocacy and Learning (FERAL)
Ph. +91 413 2671566, Fax. +91 413 2671567
Web: http://www.feralindia.org/drupal/users/rs-bhalla
More information about the grass-user
mailing list